This way we write the tests from the user's point of view: users can see
(for example) a proposal with the title "Make everything awesome", but
they don't see a proposal with a certain ID.
There are probably dozens, if not hundreds, of places where we could
write tests this way. However, it's very hard to filter which ones are
safe to edit, since not many of them have an HTML class we can use in
the tests, and adding a class might generate conflicts with CSS styles.
So, for now, I'm only changing the ones allowing us to cleanly remove
useless assignements while maintaining the code vertically aligned.
These feature tests were taking too long, we can't run them for every
single model.
I'm taking the approach of using one different model for each test, but
in theory only using a few models covering every possible scenario
would be enough.
System count isn't a relevant number because the important one is the
number of votes counted by poll officers. We're still maintaining it for
a month in case poll officers would like to review the results.
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.
The line:
create(:poll_voter, booth_assignment: booth_assignment_final_recounted)
Creates a new poll for the poll voter. Not only it wastes time by
creating new database records, but it doesn't make sense to have a poll
voter for a poll which isn't the same as its booth assignment's poll.
Cambios para hacer commit:
modificado: app/views/images/_admin_image.html.erb
modificado: spec/features/admin/poll/polls_spec.rb
modificado: spec/features/polls/polls_spec.rb
Added missing text for english and new texts in english and spanish.
Cambios para hacer commit:
modificado: app/assets/stylesheets/participation.scss
modificado: app/models/concerns/imageable.rb
modificado: app/models/poll.rb
modificado: app/views/admin/poll/polls/_form.html.erb
modificado: app/views/images/_admin_image.html.erb
modificado: config/locales/en/images.yml
modificado: config/locales/es/admin.yml
modificado: config/locales/es/images.yml
modificado: spec/features/admin/poll/polls_spec.rb
Fixes#1831
On branch aperez-validate-poll-question-is-selected
Changes to be committed:
modified: app/models/poll/question.rb
modified: spec/models/poll/question_spec.rb
modified: spec/features/admin/poll/polls_spec.rb