Commit Graph

129 Commits

Author SHA1 Message Date
Javi Martín
f535d81877 Simplify creating videos for a poll in specs 2019-09-30 14:10:46 +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
7b0771106e Remove isolated useless assignments
These variables are not surrounded by other assignments, and so they can
safely be removed without making it harder to read the code vertically.
2019-09-25 12:43:44 +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
Javi Martín
086e960d09 Add trait to simplify image creation in specs 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
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
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
2af09d65c7 Remove unused JavaScript poll token code
We don't load the token message since commit 585f9ea5, so the JavaScript
to show it wasn't doing anything anymore.
2019-09-11 01:56:27 +02:00
Javi Martín
044eabd7ef Apply Rspec/LetSetup rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
488461b8ac Remove consecutive blank lines 2019-09-10 20:02:15 +02:00
Javi Martín
87884da4e2 Avoid race conditions in votation type tests
We were performing an AJAX request and then a "normal" request without
checking the AJAX request had finished. Sometimes it resulted in the
normal request finishing because the AJAX request did, causing the test
to fail.
2019-09-10 15:58:28 +02:00
Javi Martín
b48678e332 Use have_link instead of have_css("a") 2019-09-10 15:58:28 +02:00
Javi Martín
9e522e713b Remove commented votation tests
They don't pass, and they aren't maintained anymore.
2019-09-10 15:58:28 +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
7028982103 Add set tests and change votation type tests 2019-06-12 19:44:14 +02:00
lalo
dcbd2cb379 Fix broken tests 2019-06-12 19:44:14 +02:00
German Galia
4e88de0e1f Add feature test unique, multiple, prioritized and positive negative 2019-06-12 19:44:14 +02:00
Javier Martín
14a5ea87a1 Merge pull request #3562 from consul/prepare_for_rails_5.1
Add Rails 5.1 compatibility
2019-05-29 19:11:19 +02:00
decabeza
585f9ea5ab Remove token on views temporally 2019-05-29 15:49:28 +02:00
Javi Martín
db6ed4772c Update travel_to usage
In Rails 5.1, calling `travel_to` inside another `travel_to` block will
result in a RuntimeError:

> Calling `travel_to` with a block, when we have previously already made
> a call to `travel_to`, can lead to confusing time stubbing.
2019-05-28 16:36:56 +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
Javi Martín
45a3d8daf0 Add option to enable advanced stats 2019-05-22 11:50:03 +02:00
Javi Martín
5ca528d2ce Extract method to link to a poll 2019-05-21 17:30:46 +02:00
Javi Martín
e461c8d0ac Generate navigation links for polls without a slug 2019-05-21 13:04:26 +02:00
María Checa
e3b16230e6 Added slug to polls for named urls 2019-05-16 23:40:50 +02:00
decabeza
94b8caffca Merge branch 'master' into proposal-dashboard 2019-04-04 14:08:30 +02:00
decabeza
17730a41dd Hides not to vote at this time button if already voted 2019-03-28 15:50:34 +01:00
Bertocq
9c7962c3a6 Check poll recount values for booth votes on admin panel 2019-03-28 15:49:17 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Senén Rodero Rodríguez
c73aae9663 Remove before validation callback
This was breaking nested poll_questions_answers when submitting
more than one new answer at a time.
2019-03-21 14:51:17 +01:00
rgarcia
151239924b Display 'validate document' menu item only when applicable
We are trying to avoid Officers from forgetting to click the “Confirm
vote” button, which is necessary to keep track of who has voted a Poll

To do that, we are not displaying the menu item to go back to the next
person that wants to vote, until the Officer clicks the “Confirm Vote”
button or the “The user has decided not to vote” button

Note: Due to mobile version we have duplicate ids, so using classes for
the menu items to hide them without errors

Note2: We are only hidding the menu item, if there are votable polls,
otherwise the “Confirm vote” button does not appear, and there is no
way of going back to help the next person that wants to vote
2019-03-06 18:33:07 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
bc1679550b Remove incoming polls filter 2019-02-08 14:28:19 +01:00
decabeza
62088bc635 Hide poll results and stats to admins 2019-01-24 14:33:41 +01:00
Alberto Garcia Cabeza
54fbae6339 adds links to login or verification on question answers 2018-12-05 14:31:58 +01:00
Juanjo Bazán
d8df2c1fa8 adds proper accuracy to spec 2018-11-11 14:54:58 +01:00
Javi Martín
e0b9c1bfdd Update poll question answers translatable fields
We needed to bring back support for CKEditor in our translatable form,
which we had temporarily remove.

And now we support CKEditor in our translatable specs, and so we can
remove the duplicated specs for poll question answers.
2018-10-22 16:13:48 +02:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Juan Salvador Pérez García
488e7e081f Merge branch 'dashboard' into rebase_consul_master 2018-09-27 09:18:27 +02:00
Raimond Garcia
4086220ebf Merge pull request #2914 from microweb10/make_polls_translatable
Make polls translatable
2018-09-26 13:19:17 +02:00
Julian Herrero
673ec075eb Make answers translatable 2018-09-20 17:13:40 +02:00
Javi Martín
b787e33883 Use the same system to freeze time in all specs
This required changing the `voted_before_sign_in` slightly in order to
change what the method returns if the user signed in and voted at the
exact same microsecond.

It doesn't affect production code because it would be impossible for the
user to do both things at the same time.

As a side effect, the method now returns what the method name suggests.
Before this change, the correct method name would have been
`voted_before_or_at_the_same_time_of_sign_in`.

As a less desirable side effect, in the tests now we need to make sure
at least one second passes between the moment a user votes and the
moment a user signs in again. One microsecond wouldn't work because
the method `travel_to` automatically sets microseconds to zero in order
to avoid rounding issues.
2018-09-19 14:11:50 +02:00
decabeza
bc5741fb16 Adds status icons on polls poll group 2018-08-23 18:46:14 +02:00
Juan Salvador Pérez García
50f73abb0c Fixes #voodoorai2000 comments
Fixes some comments from #voodoorai2000 for the PR to consul
2018-07-27 16:30:03 +02:00
iagirre
ccc8d9e8ea Stub the Date and Time classes so that the test doesn't depend on the time it is run. 2018-07-13 11:59:59 +02:00