Javi Martín
4e72d9f3b7
Remove useless assignments to return values
2019-09-25 12:43:44 +02:00
Javi Martín
cfaa6d6567
Remove useless assignment in i18n content spec
2019-09-25 12:43:44 +02:00
Javi Martín
320b7550ed
Simplify assigning poll to a booth in specs
...
We were creating booth assignments explicitely, but we can use the
`has_many :through` relationship to make the code easier to read.
2019-09-25 12:38:37 +02:00
Javi Martín
12cdbf6196
Simplify assigning officer to a poll in specs
...
While it could be argued we're hiding the real way we've defined
associations in our models, the tests are so much easier to read when we
don't have so many lines just creating data.
Furthermore, developers who care about vertically aligning the code will
be glad to see some variables disrupting this alignment are now gone.
2019-09-25 12:38:37 +02:00
Javier Martín
d059a564f2
Merge pull request #3722 from consul/use_traits
...
Use traits to simplify specs
2019-09-25 12:29:33 +02:00
Javier Martín
08730ba7f1
Merge pull request #3721 from consul/simplify_testing_array
...
Simplify testing array contents
2019-09-25 11:58:17 +02:00
Javier Martín
0bb6f8029e
Merge pull request #3720 from consul/featured_proposals_specs
...
Update featured proposals specs
2019-09-25 11:55:24 +02:00
Javier Martín
4ee494a46d
Merge pull request #3719 from consul/remove_redundant_code
...
Remove redundant code
2019-09-25 11:53:36 +02:00
Javier Martín
8d41114066
Merge pull request #3718 from consul/remove_obsolete_code
...
Remove unused and obsolete code
2019-09-25 11:46:09 +02:00
Javi Martín
49f81c9488
Add trait to create users with proposal and debate
2019-09-24 21:34:06 +02:00
Javi Martín
24e8f07dae
Add unfinished trait to investment factories
...
Now the code is symmetrical since we also use `finished`.
2019-09-24 21:34:06 +02:00
Javi Martín
53fa527118
Add invisible_to_valuators trait to investments
...
Now the code is symmetrical since we also use `visible_to_valuators`.
2019-09-24 21:34:06 +02:00
Javi Martín
086e960d09
Add trait to simplify image creation in specs
2019-09-24 21:34:06 +02:00
Javi Martín
52e54363ae
Add trait to create a poll associated to a budget
2019-09-24 21:34:06 +02:00
Javi Martín
4edab79910
Use yes_no trait to simplify creating answers
...
We lose some variety in our answers, though, but on the plus side, we
reduce the risk of trademark issues :P.
2019-09-24 21:34:06 +02:00
Javi Martín
19a41eb651
Rename trait with_answers to yes_no
...
We barely use this trait. In the votation type spec we're probably using
it wrong, and in the answer spec we assume one of the answers is going
to be "Yes".
The name `yes_no` is more expressive, since it makes it clear what the
answers are.
2019-09-24 21:34:06 +02:00
Javi Martín
aeb1655961
Use budget phase traits
...
We were already using them in many places, but not everywhere.
2019-09-24 21:34:06 +02:00
Javi Martín
cced12c3a0
Use feasibility traits to simplify code
2019-09-24 21:34:06 +02:00
Javi Martín
eb53e033be
Use finished trait to simplify code
...
It's more concise than writing `valuation_finished: true`.
2019-09-24 21:34:06 +02:00
Javi Martín
30a30c5f00
Use with_administrator trait to simplify code
...
It's more concise than writing `administrator: create(:administrator)`
2019-09-24 21:34:06 +02:00
Javi Martín
2b2c528098
Use hidden trait in specs
...
We were using it in most places, but there were a few where we still
used `hidden_at: Time.current`.
2019-09-24 21:34:06 +02:00
Javi Martín
f27beb1e47
Simplify testing array contents
...
We were testing for the size and the content of the elements when we
could test for the array itself.
2019-09-24 21:32:52 +02:00
Javi Martín
4301937e85
Check arrays are empty instead of size 0
...
In ruby we check for `array.empty?` instead of `array.size == 0`, so
it's natural to write the tests in the same way.
2019-09-24 21:32:28 +02:00
Javi Martín
98fe8349d7
Use match_array instead of sorting arrays
...
It does the same thing, and it's easier to read.
2019-09-24 20:50:49 +02:00
Javi Martín
4a80653d2f
Remove redundant checks for array size
...
If we check the exact contents of the array, checking the size is
implicit.
2019-09-24 20:50:48 +02:00
Javi Martín
8ec8002acd
Enable featured proposals when they're used
...
These specs were added before we disabled featured proposals by default.
After that, they were passing, but they were not testing the scenario
they were supposed to test.
2019-09-24 20:05:02 +02:00
Javi Martín
52c8691aae
Don't create featured proposals if disabled
...
Before we disabled featured proposals by default, there were many tests
creating them because they were needed in order to create non-featured
proposals.
But now these tests don't need to create featured proposals anymore.
2019-09-24 20:04:39 +02:00
Javi Martín
2ad6ced12f
Create featured proposals if enabled
...
We had a case where we created 5 extra records in pagination and checked
2 records were present, because the other 3 were automatically
considered featured proposals.
Explicitely creating featured proposals let us create 2 extra records
and check 2 records are present, which is far more intuitive.
2019-09-24 20:03:52 +02:00
Javi Martín
01862d6664
Remove unused attributes creating a heading
...
The "name" attribute is automatically generated by the budget heading
factory. And the "price" attribute is out of context and not needed
since this test doesn't create investments.
2019-09-24 20:02:09 +02:00
Javi Martín
f5849cb5d8
Remove unnecessary question creating answers
...
Questions are automatically created by the poll_question_answer factory.
2019-09-24 19:55:42 +02:00
Javi Martín
e1c09769a8
Remove unnecessary data in polls spec
...
This data was added in commit 62088bc6 , but the changes in that commit
don't seem to be related to the number of questions in a poll.
2019-09-24 19:55:37 +02:00
Javi Martín
ef0330f671
Remove duplicate test
...
One test was testing regular users can't access results, and another one
was testing neither regular users nor managers can. So the second test
can just test the admin scenario, and we're still covering everything.
2019-09-24 19:50:18 +02:00
Javi Martín
adf59cc963
Move related tests together
2019-09-24 19:50:18 +02:00
Javi Martín
7db32b337b
Remove unnecessary author variables in specs
...
The factories creating proposals and debates automatically create an
author.
2019-09-24 19:50:14 +02:00
Javi Martín
fe5b45ed18
Remove unnecessary poll creating assignments
...
The factory creating assignments automatically assigns a poll to it, so
we don't use the poll for anything else, there's no need to explicitely
create it.
2019-09-24 19:48:22 +02:00
Javi Martín
9d627f2db9
Remove redundant I18nContent scope
...
Since two records cannot have the same key, having a scope that will
always return just one record is the same as using `find_by_key`.
2019-09-24 19:29:46 +02:00
Javi Martín
9fcea17849
Remove useless parameter in URL
...
The proposal parameter was accidentally added in commit 16692c93 , but
the proposals index doesn't receive a proposal as parameter.
2019-09-24 19:28:36 +02:00
Javi Martín
da425b9164
Remove commented graphql code
...
This code was commented in commit ad8aba07 .
2019-09-24 19:27:17 +02:00
Javi Martín
82ea866b6d
Remove commented graphql tests
...
These tests use a "proceeding" method in proposals, which does not
exist.
2019-09-24 19:27:08 +02:00
Javi Martín
cb2069858c
Remove unnecessary code
...
It looks like these variables were left by accident. The Ruby
interpreter was giving us warnings about unused variables.
2019-09-24 18:49:40 +02:00
Javi Martín
fcaa30dc57
Remove obsolete URL reference
...
This URL was accidentally copied from Madrid's repository. However, we
don't use it in CONSUL.
2019-09-24 18:49:40 +02:00
Javi Martín
fb6d12c8ab
Remove obsolete data creation
...
This data is obsolete since commit 9d1ca3bf .
Note we should have probably moved the test to the model, since now the
`to_csv` method isn't tested anywhwere, and we should probably add a
test in the future. The code now uses the new DownloadSetting model,
though, making it hard to test.
2019-09-24 18:49:40 +02:00
Javi Martín
748ee3d804
Remove obsolete confirm messages references
...
This code is obsolete since commits 122b1703 and bbf3faa7 .
2019-09-24 18:33:47 +02:00
Javi Martín
06030933a4
Remove obsolete poll answers variable
...
This code is obsolete since commit c6e4b248 .
2019-09-24 18:29:33 +02:00
Javi Martín
f767f231dc
Remove obsolete notices in booth assignments
...
This code is obsolete since commit 085e6ecb .
2019-09-24 18:26:11 +02:00
Javier Martín
989b2e23f7
Merge pull request #3711 from consul/fix_managers_suggestions
...
Allow managers to read investment suggestions
2019-09-24 14:32:20 +02:00
Javier Martín
671d49c8df
Merge pull request #3713 from consul/reduce_translatable_specs
...
Make translatable specs faster
2019-09-24 14:30:10 +02:00
Javi Martín
11d16e7aad
Simplify translatable tests in the public area
2019-09-23 18:01:44 +02:00
Javi Martín
44d137a4c0
Simplify translatable tests in admin section
...
These feature tests were taking too long, we can't run them for every
single model.
I'm taking the approach of using one different model for each test, but
in theory only using a few models covering every possible scenario
would be enough.
2019-09-23 18:01:44 +02:00
Javi Martín
ef7606bb45
Move translatable file to features folder
...
This change breaks the tests, but makes future commits easier to review.
2019-09-23 18:01:44 +02:00