Commit Graph

74 Commits

Author SHA1 Message Date
Javi Martín
b431273869 Simplify creating officer assignments in specs
Note we usually cannot make it simple because officer assignments are
usually assigned to both a poll and a booth, and on a certain date.
However, in the few cases where the booth nor the date don't matter, we
can make the code a bit easier to read.
2019-09-30 14:10:45 +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
5cbd160f11 Move login_as after creating data for a test
It doesn't really affect the tests, but it helps isolate useless
assignments, and we already did it this way 94% of the time.
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
Javi Martín
da121ebc53 Remove redundant setting resets in after blocks
Settings are stored in the database, and so any changes to the settings
done during the tests are automatically rolled back between one test and
the next one.

There were also a few places where we weren't using an `after` block but
changing the setting at the end of the test.
2019-09-23 13:47:45 +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
taitus
230d1a4e9d Not display :year_of_birth when :date_of_birth is present 2019-07-29 13:10:09 +02:00
taitus
3e383d7c1f Add new fields to form
- Add :date_of_birth and :postal_code
- Only display new fields when aplication has configured the
custom census API and contains alias values for fields. Add 2
class Setting methods to check this feature:
  - force_presence_date_of_birth?
  - force_presence_postal_code?
2019-07-29 13:10:09 +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
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
voodoorai2000
29f5268e42 Display polls for current booth
Polls that were not votable by a user were not being displayed in the officing interface. Creating a confusing situation for officers.

With this commit polls that are not votable by a user will be displayed, with the corresponding message explaining that that poll can only be voted by residents of a certain geozone.
2019-05-24 15:20:54 +02:00
Bertocq
ba9346162c Improve officing result specs 2019-05-21 13:26:44 +02:00
decabeza
94b8caffca Merge branch 'master' into proposal-dashboard 2019-04-04 14:08:30 +02:00
iagirre
a9d1fd3539 Fix for issues 1202, 1203 and 1204. Stub the Date and Time functions in the booth_spec test so that it won't give errors when running tests at midnight. 2019-03-28 15:49:17 +01:00
Bertocq
71bd6e41c6 Replace time.zone.today for date.current 2019-03-28 15:49:17 +01:00
Bertocq
94c37eb588 Fix store officer and booth info spec 2019-03-28 15:47:52 +01:00
Bertocq
4e4057573d Fix store officer and booth info spec 2019-03-28 15:47:52 +01:00
Bertocq
8e61075659 Make clearer the set officing booth usage for secondary booth 2019-03-28 15:47:52 +01:00
Bertocq
49ffcfac06 Move set officing booth helper method calls to background block 2019-03-28 15:47:52 +01:00
Bertocq
d2e8f84759 Create missing shift and choose booth for the officer 2019-03-28 15:47:52 +01:00
Bertocq
80a9ba8aa7 Enable and fix booth selection back 2019-03-28 15:47:52 +01:00
rgarcia
88c801d6c5 fixes specs 2019-03-28 15:47:52 +01:00
rgarcia
0acec655e2 fixes specs 2019-03-28 15:47:52 +01:00
rgarcia
4761ac91bd Displays officing booth in layout 2019-03-28 15:47:52 +01:00
rgarcia
9c59c8b68e displays booth location instead of booth name 2019-03-28 15:47:52 +01:00
rgarcia
0286ca4c59 displays single booth for any number of polls 2019-03-28 15:47:52 +01:00
rgarcia
5dea0e039e updates notice 2019-03-28 15:47:52 +01:00
rgarcia
74706027cb fixes specs 2019-03-28 15:47:52 +01:00
rgarcia
b4499321d3 stores officer booth on sign in 2019-03-28 15:47:52 +01:00
rgarcia
5835d12694 stores the officer that allowed a voter to vote in a physical booth 2019-03-28 15:47:52 +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
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
c8f49644ce Fixes english translations 2018-11-08 12:07:13 +01:00
Javi Martín
02b8bc6f69 Simplify the way to freeze time in specs 2018-09-19 14:10:18 +02:00
Javier Martín
735eab8e71 Avoid date changes during residence tests.
As it happened with results (commit 4a559ed), these tests failed if
`Date.current` changes between the moment records are created and the
moment the rest of the test is executed.
2018-07-09 00:17:15 +02:00
Javier Martín
de0afe1621 Don't monkey patch ActiveSupport.
It could have side effects (for example, a conflict after upgrading to
Rails 5).

Thanks @aitbw for the suggestion!
2018-07-09 00:06:55 +02:00
Javier Martín
4a559ed3cd Avoid date changes during results tests.
As explained by @iagirre with pinpoint accuracy [1]:

"If the officer_assignments are created at 23:59:59 and the rest of the
test is executed after 00:00:00, the dates for the objects and the
`Date.current` (used to check if there are any shifts today) won't be
the same, because the shift will be for, lets say, 07/03/2018 and
`Date.current` will be 08/03/2018, so, there are no shifts."

Freezing time avoids this issue.

Related to issues #2520 and #2521.

[1] https://github.com/AyuntamientoMadrid/consul/pull/1342
2018-07-09 00:06:55 +02:00
decabeza
16ff5c4400 Hides sidebar menus if officer has no shifts assigned 2018-07-04 17:22:03 +02:00
Vicente Mendoza
910d49d18c Focus the search of the button 2018-02-09 12:51:15 +01: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
c6d683083f Merge pull request #2073 from consul/feature/2072#remove_question_valid_answers
Remove valid answers usage
2017-10-18 11:52:14 +02:00
Bertocq
39f23d3b7b Switch from valid_answers to question_answers on specs 2017-10-18 01:28:38 +02:00
Bertocq
04910fea5b Remove officing results date picker for current date 2017-10-17 21:00:19 +02:00
Bertocq
24ef7984a3 Include the answerable by user scope back on Poll list for officer voting panel 2017-10-04 17:05:25 +02:00
Bertocq
2900104a07 Show only active polls from the shifts assigned to officer on vote panel 2017-10-04 13:11:13 +02:00
Bertocq
85087b0bea Check officer value for Poll Voter created from officing panel 2017-10-04 01:09:51 +02:00
Bertocq
b5cf28cb35 Swap Poll White/Null/Total usage for Poll Recount 2017-10-02 15:46:49 +02:00