Commit Graph

68 Commits

Author SHA1 Message Date
Javi Martín
92bfc9ed17 Use text instead of IDs in feature specs
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.
2019-09-30 14:29:15 +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
44d137a4c0 Simplify translatable tests in admin section
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.
2019-09-23 18:01:44 +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
bddfee2b86 Remove system count column for old polls
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.
2019-08-07 20:31:45 +02:00
Senén Rodero Rodríguez
3176be43d9 Rename "translatable" shared example to "edit_translatable"
Also rename all specs calls
2019-06-27 09:20:25 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
Alberto
2f8505332e Merge pull request #3574 from consul/remove-dashboard-polls
Allow users to delete dashboard polls
2019-06-01 11:06:34 +02:00
decabeza
bc1fc5d929 Add button to delete a poll 2019-05-31 11:55:05 +02:00
decabeza
cec1d5e5f0 Hide polls created by users from proposals dashboard on admin poll index 2019-05-31 11:34:55 +02:00
Javi Martín
123196e4ed Display the same results for stats and recounts
In the recounts we were incorrectly assuming the total amount included
the blank and invalid ballots.
2019-05-30 17:22:39 +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
Javier Martín
cbfa2c1df8 Merge pull request #3504 from consul/backport-poll_slugs
Add slug to polls
2019-05-21 13:42:47 +02:00
María Checa
0c6e7e7580 Adds Sluggable concern to Poll model 2019-05-17 05:41:09 +02:00
decabeza
e026412389 Add button to delete a poll 2019-05-14 16:46:56 +02:00
Javi Martín
d69adbccb7 Avoid creating extra poll records in tests
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.
2019-03-19 13:29:45 +01:00
Javi Martín
8118926ba7 Simplify tests creating poll voters 2019-03-19 13:29:43 +01:00
Julian Herrero
58f22915e9 Use double quotes 2019-03-15 09:57:09 +01:00
Julian Herrero
da04f6caa7 Add test for booth votes case 2019-03-15 09:55:12 +01:00
Alberto
3c313c9c52 Merge pull request #3334 from consul/admin-polish
Improve UX on admin section
2019-03-13 17:15:22 +01:00
decabeza
83e8d6035a Remove questions link on admin polls menu 2019-03-13 13:33:49 +01:00
Javi Martín
db6229e38e Add specs for cumulative recounts totals 2019-03-07 02:09:17 +01:00
Julian Nicolas Herrero
2f84d17cc9 Merge pull request #3155 from jaflutz/2824-options-display-results-polls
Enable options to show stats and results with any type of voter
2019-03-06 11:14:54 +01:00
decabeza
dfd4f60e15 Order admin poll list by starts_at date 2019-01-31 18:49:24 +01:00
decabeza
5ea1275e6a Change admin poll list title 2019-01-31 18:24:28 +01:00
João Lutz
47a33ea86c Enable options to show stats and results with any type of voter 2019-01-05 14:08:47 -02:00
Javi Martín
759de935ee Update polls translatable fields
The `:name` attribute is still allowed in the controller because some
forks use it when creating a poll from a budget.
2018-10-22 15:52:58 +02:00
Julian Herrero
df9955e0c6 make use of the new spec helper it_behaves_like translatable 2018-09-21 20:52:35 +02:00
Julian Herrero
9495208518 Make polls translatable 2018-09-20 17:07:43 +02:00
Angel Perez
44b1eb929a Move 'Show stats and results' form to Admin::Poll#results tab 2018-05-23 07:27:12 -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
7f14544f71 Enable Capybara/CurrentPathExpectation cop & fix issues
Read cop description http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation to better understand reasons behind enforcing this rule

On some cases the `only_path: true` was needed as argument of `have_current_path` matcher to avoid comparing the url parameters and just checking the path.
2018-01-06 23:31:41 +01:00
María Checa
b1e91cdc03 Tests improvements 2017-10-23 12:57:52 +02:00
María Checa
6b5c29f23e Added tests 2017-10-23 12:25:51 +02:00
rgarcia
6a697bd6d0 adds specs 2017-10-19 11:28:09 +02:00
Bertocq
39f23d3b7b Switch from valid_answers to question_answers on specs 2017-10-18 01:28:38 +02:00
Bertocq
60f2815010 Add missing total_results check on poll result specs 2017-10-18 01:27:39 +02:00
decabeza
090ff83cc1 updates edit texts on specs 2017-10-09 20:09:56 +02:00
iagirre
4035097c60 Specs added for branch polls-show in consul and thumbnail for poll images in admins views.
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
2017-10-04 16:43:35 +02:00
Raimond Garcia
c7f576aa4f Merge pull request #1962 from wairbut-m2c/iagirre-admin-polls-section
Iagirre admin polls section
2017-10-03 22:23:53 +02:00
BertoCQ
3835821871 Merge branch 'master' into iagirre-admin-polls-section 2017-10-02 22:25:09 +02:00
BertoCQ
7f936f440c Merge branch 'master' into polls_minor_changes 2017-10-02 16:44:53 +02:00
María Checa
afbdd48891 Fixed tests 2017-10-02 16:11:17 +02:00
Bertocq
b5cf28cb35 Swap Poll White/Null/Total usage for Poll Recount 2017-10-02 15:46:49 +02:00
iagirre
166caa3b4c Deleted code in views and concerns that lets polls have more images and documentes attached, like it was at first.
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
2017-10-02 12:59:26 +02:00
BertoCQ
34568567a3 Merge pull request #1885 from consul/chore/remove_final_recounts
Remove Poll Final Recounts, replace with Total Results
2017-09-20 23:00:03 +02:00
Bertocq
851d397395 Replace FinalResult with TotalResult at admin Poll Recounts page 2017-09-19 00:54:46 +02:00
Angel Perez
0611e0f4ea Validate presence of 'poll_id' attribute on Poll::Question model
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
2017-09-14 11:52:19 -04:00
Bertocq
d98425f45b Remove daily officer recounts from admin poll recounts list 2017-07-23 23:28:38 +02:00