Commit Graph

37 Commits

Author SHA1 Message Date
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
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
lalo
dcbd2cb379 Fix broken tests 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
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
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
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01: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
Angel Perez
ff74d66405 Remove unnecessary extra expectation for 'Voting in booth' scenario 2018-03-27 14:47:50 -04:00
rgarcia
8fb9be9d07 Fix RSpec's should deprecation warning
Using `stub` from rspec-mocks' old `:should` syntax without explicitly
enabling the syntax is deprecated. Use the new `:expect` syntax or
explicitly enable `:should` instead
2018-01-22 17:40:56 +01:00
Angel Perez
9a0eca73d7 Fix: Deprecation warnings when running test suite (#2287) 2018-01-09 17:54:46 -04:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
2d355ce938 Enable RSpec/LetSetup cop & fix issues
Read more about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
2018-01-07 16:23:49 +01:00
María Checa
bb06af3877 Improved results tests 2017-10-20 16:49:25 +02:00
María Checa
8be8bb07f9 Added first poll results tests 2017-10-19 12:17:49 +02:00
BertoCQ
d3fb4e2615 Merge pull request #2066 from consul/poll-voting
Adds spec for user voting in booth and then verifying account
2017-10-17 21:21:12 +02:00
rgarcia
6b7d38c27a adds spec for user voting in poll and then verifying account 2017-10-17 15:00:34 +02:00
BertoCQ
db7c80ef13 Merge pull request #2021 from consul/fixed-already-voted-message
Fixed already voted message in poll show
2017-10-17 14:42:46 +02:00
María Checa
712151b395 Tests improvements 2017-10-17 13:17:20 +02:00
María Checa
e1e9b431d7 Added tests 2017-10-16 20:10:49 +02:00
decabeza
f94a376392 updates text on specs 2017-10-13 14:16:46 +02:00
rgarcia
c097cf236c updates specs 2017-10-13 12:41:43 +02:00
María Checa
84e35edca7 Added new tests for vote token 2017-10-07 16:16:39 +02:00
María Checa
089c1fecfd Added tests 2017-10-06 13:37:24 +02:00
Bertocq
895fc96bee Correct voter feature spec scenario name 2017-10-05 00:39:05 +02:00
Raimond Garcia
1b58b7851b Merge branch 'master' into fix/shift_creation_polls 2017-10-04 20:14:08 +02:00
Bertocq
c62b573489 Fix poll Voter feature spec 2017-10-04 17:59:29 +02:00
rgarcia
007bcb7ec7 fixes specs 2017-10-04 17:46:25 +02:00
María Checa
5b7a90221a Fixed tests 2017-10-04 11:18:09 +02:00
Bertocq
825671ad9b Fix polls answer this question show text 2017-10-03 18:53:44 +02:00
rgarcia
085991c624 allows voting only in one origin: booth or web 2017-10-02 16:22:31 +02:00