Commit Graph

19 Commits

Author SHA1 Message Date
Javi Martín
071bcb7023 Add and apply Rails/I18nLocaleAssignment rule
This rule was added in rubocop-rails 2.11.0.

Although we prevent I18n locale leaking between tests by setting it
before each test, the `with_locale` method makes the scope of the locale
change more obvious.
2021-09-03 11:49:52 +02:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
66334b5757 Add globalizable tests for all translatable models
So now we test in depth at the model level, and can be a bit more
relaxed about integration tests for translations.

Note we're defining some extra factories to make sure all translatable
attributes with presence validation rules are mandatory. This way we can
simplify the way we obtain required fields, using `required_attribute?`.
Otherwise, fields having an `unless` condition in their presence
validation rules would count as mandatory even when they're not.
2019-09-23 18:01:44 +02:00
Javi Martín
41c99d9b27 Let Globalize use I18n locale
This is a mistake I made in commit f2ef27d3. Back then I thought we
needed to keep Globalize.locale and I18n.locale in sync, but the truth
is it automatically happens when setting Globalize.locale to nil.

So now we can use I18n.with_locale (at least in the tests) and forget
about Globalize, which will make it easier to switch to Mobility in the
future.
2019-09-23 18:01:44 +02:00
Senén Rodero Rodríguez
caa9e1cd49 Enable soft_deletion of Poll::Question::Translations 2019-06-27 09:19:36 +02:00
lalo
7c9c50f4c6 Add Model changes to work with votation_types 2019-06-12 19:32:41 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Javi Martín
ccdbdb26ba Fix poll question with non-underscored locales
Ruby can't have hyphens in method names, so sending something like
`title_pt-BR=` would raise an exception.
2018-10-23 14:23:10 +02: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
ed16a78f42 Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
2018-01-07 01:03:45 +01:00
Bertocq
fbcf8678c3 Remove no longer needed question model tests for valid_answers 2017-10-18 01:28:59 +02:00
Angel Perez
15ccef8c97 Poll::Question model spec refactor to improve DRYness
On branch aperez-validate-poll-question-is-selected
  Changes to be committed:
    modified:   spec/models/poll/question_spec.rb
2017-09-19 07:08:18 -04: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
kikito
15b531f068 Fixes failing specs 2017-01-24 18:10:41 +01:00
rgarcia
d3a35971cd fixes spec 2016-11-24 20:37:03 +01:00
rgarcia
ceebae644f removes question column from poll_questions 2016-11-22 11:41:10 +01:00
kikito
38efad77f3 Changes the way question#copy_attributes_from_proposal works 2016-11-11 19:11:53 +01:00
kikito
85aba10798 Initial work in Poll::Question 2016-10-28 18:02:28 +02:00