Commit Graph

101 Commits

Author SHA1 Message Date
Javi Martín
f426b25fe5 Remove unneeded factories
These factories were only used in one place and they even declared ID
attributes. Using the comment factory with the `commentable` attribute
does the same thing.
2019-09-29 22:52:53 +02:00
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
adc5906253 Apply Rails/PluralizationGrammar rubocop rule 2019-09-10 21:43:38 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
488461b8ac Remove consecutive blank lines 2019-09-10 20:02:15 +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
Javi Martín
bd85aede99 Use describe on new 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.

We're also adding a rubocop rule so we dont' accidentally add these
keywords again.
2019-08-07 13:53:27 +02:00
German Galia
4f50e67ac3 Collaborative legislation summary 2019-06-03 12:34:25 +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
decabeza
e7eade2b33 Add spec to legislatiorn processses with past filter
This filter was removed from admin view but keep existing on front views.
2019-02-11 17:28:18 +01:00
decabeza
060a4c684f Remove legislation processes next filter 2019-02-08 14:29:43 +01:00
Julian Nicolas Herrero
81b65ec821 Merge pull request #3202 from consul/sort_legislation_processes_by_start_date
Sort Legislation Processes by descending start date
2019-01-29 17:30:02 +01:00
Javi Martín
b552f6e70b Add heading to milestones progress bars 2019-01-24 17:33:43 +01:00
Javi Martín
e73f3bd97a Add progress bars to milestones public view 2019-01-24 17:33:34 +01:00
Julian Herrero
33d6f6c18d Sort Legislation Processes by descending start date 2019-01-22 18:51:22 +01:00
decabeza
9dfbeed140 Moves draft and final result publication dates from tabs to sidebar 2019-01-15 16:13:41 +01:00
decabeza
73637de0d0 Adds homepage phase and tab to legislation processes show 2019-01-15 16:13:38 +01:00
Alberto
bbcb96027b Merge pull request #3137 from consul/key-dates-processes
[Backport] Processes key dates
2019-01-08 10:51:40 +01:00
decabeza
dd8e2d6311 Shows participation phases only if there is a phase enabled 2018-12-28 18:23:08 +01:00
decabeza
a8fb479be5 Adds specs for show view has document present on all phases 2018-12-28 17:22:08 +01:00
Raimond Garcia
d583c93ebf Merge pull request #3118 from consul/rubocop-not-to
Apply Rubocop not_to rule
2018-12-19 12:47:37 +01:00
Raimond Garcia
ea435ac56c Merge pull request #3112 from consul/rubocop_not_to
Add not_to Rubocop rule
2018-12-19 11:29:44 +01:00
voodoorai2000
b8cc7c5389 Apply rubocop not_to rule 2018-12-19 11:23:53 +01:00
dperez
bef404c443 add homepage for legislation processes 2018-12-15 18:04:24 +01:00
voodoorai2000
7917cea676 Change to_not for not_to
Eventhough some of us sentimentals still like the syntax `to_not` the current trend is to move to the new syntax `not_to`.

In this commit we are updating the references of expectations that used `to_not` to `not_to`.
2018-12-15 12:33:28 +01:00
Javi Martín
b95ca9df8a Add milestones to legislation process view 2018-12-11 20:18:53 +01:00
Javier Martín
364321bf33 Merge pull request #3090 from consul/backport-time_related_specs
[Backport] Add frozen time condition to proposals phase spec
2018-12-10 13:47:38 +01:00
Javi Martín
a769c61c02 Add frozen time condition to proposals phase spec
Backport the part of AyuntamientoMadrid@ea6fcb5 which hadn't been
backported yet.
2018-12-07 15:09:07 +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
João Lutz
34b58a5208 Adds draft phase functionality in legislation processes 2018-11-19 22:18:50 -02:00
decabeza
5abeeb8588 Fixes date format on legislation helper 2018-11-14 12:41:22 +01:00
Javi Martín
2e6644d513 Fix crash with no translation for default locale
When we were visiting a page showing the content of a record which uses
globalize and our locale was the default one and there was no
translation for the default locale, the application was crashing in some
places because there are no fallbacks for the default locale.

For example, when visiting a legislation process, the line with
`CGI.escape(title)` was crashing because `title` was `nil` for the
default locale.

We've decided to solve this issue by using any available translations as
globalize fallbacks instead of showing a 404 error or a translation
missing error because these solutions would (we thinkg) either require
modifying many places in the application or making the translatable
logic even more complex.

Initially we tried to add this solution to an initializer, but it must
be called after initializing the application so I18n.fallbacks[locale]
gets the value defined in config.i18n.fallbacks.

Also note the line:

fallbacks[locale] = I18n.fallbacks[locale] + I18n.available_locales

Doesn't mention `I18n.default_locale` because the method
`I18n.fallbacks[locale]` automatically adds the default locale.
2018-10-22 16:36:18 +02: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
Javi Martín
ec18743251 Authorize resource after authenticating user
Just like it's done everywhere else in the application. Not doing so
means users who aren't logged in receive a "you aren't authorized"
message when they try to create a new legislation proposal instead of
being redirected to the login page.
2018-10-03 22:06:20 +02:00
María Checa
388c1a9bd9 Improved tests 2018-10-03 16:02:41 +02:00
María Checa
d73be15296 Added tests 2018-10-03 16:02:41 +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