Commit Graph

24 Commits

Author SHA1 Message Date
Javi Martín
dcc9a6b561 Use symbols instead of constants for behaviours
This way we can be more flexible about the factory we can pass as
parameter.
2019-09-29 22:31:13 +02:00
Javi Martín
1c071b5ff0 Reduce the number of proposals in pagination spec
We're getting a failure on Travis in one of these tests. Debugging shows
the AJAX request rendering the first page (after clicking the "Previous"
link) takes too long and sometimes it exceeds Capybara's timeout.

After running the test thousands of times, the only way I've found to
clearly reduce the number of times the test fails is to reduce the
number of records shown on the first page. Other experiments, like
adding an `includes(:author)` to the query getting the proposals in the
controller, or adding `author: user` to the `create_list` part of the
test (so only one author needs to be fetched when rendering the
proposals) show inconsistent results regarding performance.

Note we still need at least 10 proposals for the test for several users,
to guarantee two users will never get the same records during the test
(or at least the probability they get the same records is one in
millions).
2019-09-10 15:01:36 +02:00
decabeza
5fd493cd2c Add link to process on legislation processes proposals 2019-05-31 11:40:48 +02:00
Javi Martín
307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
0ae1cdfc8c Replace total votes to cached_votes_score on legislation proposals
This show votes_score as result of votes_up minus votes_down
2019-02-12 18:42:41 +01:00
Javi Martín
09add3554f Create less records in random pagination tests
We make the tests considerably faster, we make them more robust against
changes in the number of records shown per page, and we generate enough
records so the chance of randomly getting the same results twice in a
row is extremely low.
2018-12-05 13:11:23 +01:00
Javi Martín
64167a86b4 Be more consistent using double quotes 2018-12-05 13:11:23 +01:00
Javi Martín
637c188bee Make test easier to follow
Checking the contents of the second page while on the second page makes
more sense than checking them after going back to the first page.
2018-12-05 13:11:22 +01:00
Javi Martín
f391023b7d Group related specs together 2018-12-05 13:08:24 +01:00
Javi Martín
6f62d76c71 Simplify random seed conversion to float
The method `to_f` already returns `0.0` instead of raising an exception
when handling non-numeric values.
2018-12-05 13:03:10 +01:00
Julian Herrero
333098502e fix typo 2018-12-02 18:12:03 +01:00
Javi Martín
959270b0bb Separate setup, actions and expections in specs 2018-10-04 16:31:00 +02:00
Javi Martín
9c13f08c8e Show selected legislation proposals by default 2018-10-04 16:31:00 +02:00
Javi Martín
d9410a132a Always show filters for legislation proposals
As done in the rest of the application: we show the filters even if
there isn't any data to display.
2018-10-04 16:31:00 +02:00
Javi Martín
81871a56f8 Simplify legislation process specs
We kill two birds with one stone and also make each line less than 100
characters long.
2018-10-04 16:30:59 +02:00
Javi Martín
f1745f8040 Fix typo 2018-10-04 16:29:01 +02:00
Raúl Fuentes
a859de5d16 Test the selectable proposals 2018-10-04 16:29:01 +02:00
Bertocq
52df63c2aa Add legislation proposal feature scenario to check random order is consistent with pagination 2018-10-03 13:46:32 +02:00
Bertocq
89b8e51a93 Add helper function to get legislation proposals list order on feature spec 2018-10-03 13:46:32 +02:00
Bertocq
d36e47c740 Add legislation proposal spec, with random list order scenario 2018-10-03 13:46:00 +02:00
decabeza
7c194f6042 Adds imageable to legislation proposals 2018-10-01 16:48:46 +02:00
Angel Perez
43b040162d fix(frontend): Only one menu element has 'active' CSS selector 2018-08-06 10:13:41 -04:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00