Commit Graph

111 Commits

Author SHA1 Message Date
Javi Martín
a04a289850 Simplify testing arrays exact contents
Instead of testing the contents of each element, we can test the whole
array at once.
2019-09-29 23:24:53 +02:00
Javi Martín
bfd39a13e0 Remove unnecessary attributes in proposals spec
These tests are only checking which proposals are not included in the
recommendations, so we don't need to sort the included ones, just like
we don't use the cached votes up attribute in the tests preceeding these
ones.
2019-09-29 22:31:13 +02:00
Javi Martín
97375f557f Fix typo in proposals spec
The test passed even if proposal recommendations returned archived
proposals, because we forgot to add the tag list the user is interested
in.
2019-09-29 22:31:07 +02:00
Javi Martín
f27beb1e47 Simplify testing array contents
We were testing for the size and the content of the elements when we
could test for the array itself.
2019-09-24 21:32:52 +02:00
Javi Martín
4301937e85 Check arrays are empty instead of size 0
In ruby we check for `array.empty?` instead of `array.size == 0`, so
it's natural to write the tests in the same way.
2019-09-24 21:32:28 +02:00
Javi Martín
4a80653d2f Remove redundant checks for array size
If we check the exact contents of the array, checking the size is
implicit.
2019-09-24 20:50:48 +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
ffc50246c2 Apply explict RSpec/DescribedClass rubocop rule
We settled on using this style in commit 4cbe81a1, but didn't add the
rule enforcing this style and we didn't apply it to existing code.
2019-09-23 16:51:00 +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
adc5906253 Apply Rails/PluralizationGrammar rubocop rule 2019-09-10 21:43:38 +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
e252d82cdb Apply IndentationWidth rubocop rule 2019-09-10 20:02:15 +02:00
Senén Rodero Rodríguez
2079706845 Enable soft deletion of Proposal::Translations 2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
f572d5b579 Add translations to proposal pg_search_scope
Some Proposal attributes are now translatable so we need to include all
existing translations on pg_search scope.
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
dd310f7507 Add sanitization shared spec to proposal 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
lalo
3282606be2 Add act_as_taggable_on milestoneable concern 2019-06-07 14:07:43 +02:00
Julian Herrero
a852696eeb Remove not selected proposals from other lists 2019-05-30 11:19:38 +02:00
Julian Herrero
9948804e21 Add selected attribute to proposals 2019-05-29 16:51:27 +02:00
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
0995480b73 Remove question and external_url fields from proposals 2019-04-30 11:35:47 +02:00
decabeza
20f505ab7c Fix specs 2019-04-29 15:44:41 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Julian Herrero
83e129d5b7 Fix failing tests
If tests run very fast all votes are created within the last 24
hours, so hot_score has the same value if the creation date for the
votes is Time.current or 1.day.ago.

Creating the votes 48 hours ago we make sure hot_score has the
correct value and the tests pass correctly.
2019-04-17 17:40:56 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
taitus
08383b9cac Send new notification email after publish Proposal
After publish a proposal send email to proposal's author with information text and new actions available.
2019-03-21 12:29:30 +01:00
taitus
c959e078b8 Send new action notification email after create Proposal
After create a proposal send email to proposal's author with information text and new actions available.
2019-03-20 11:50:47 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
ef835bef1c new algorithm for filter 'most active' 2018-12-13 11:42:22 +01:00
María Checa
a62b5c1492 Removes author from Proposal#users_to_notify 2018-07-26 12:51:34 +02:00
Bertocq
4f6597b200 Enable RSpec/RepeatedDescription cop & fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
2018-01-07 17:45:34 +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
1441de5107 Enable RSpec/HookArgument cop and fix issues
To be consistent about before/after arguments, as `:each` or `:example`
 are same and default scopes, best not to send an argument in those
 scenarios.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
2018-01-07 02:07:19 +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
fa017b664f Enables RSpec/EmptyLineAfterFinalLet cop & fixes all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
2018-01-07 00:49:37 +01:00
Bertocq
265d4d0967 Enables RSpec/DescribedClass cop & fixes all issues
Autocorrection for existing issues, and stashing at .rubocop_todo.yml
the false positives

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
2018-01-07 00:38:19 +01:00
rgarcia
0152b6301c adds specs 2017-12-19 20:36:10 +01:00
Angel Perez
63317714c3 Proposal recommendations won't include archived or already supported proposals 2017-12-15 22:40:24 -04:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00
Bertocq
ce0a7f6fad Rubocop autocorrections 2017-10-17 22:00:00 +02:00
BertoCQ
87c99018e7 Merge branch 'master' into user-recomendations 2017-09-14 23:45:56 +02:00
Angel Perez
2181a65bc2 Allow only YouTube/Vimeo URLs on 'video_url' attribute
Fixes #1841

On branch aperez-valid-video-url
  Changes to be committed:
    modified:   app/models/proposal.rb
    modified:   spec/factories.rb
    modified:   spec/models/proposal_spec.rb

Allow only YouTube/Vimeo URLs on 'video_url' attribute

Fixes #1841

On branch aperez-valid-video-url
  Changes to be committed:
    modified:   app/helpers/embed_videos_helper.rb
    modified:   app/models/proposal.rb
    modified:   spec/features/management/proposals_spec.rb
    modified:   spec/features/proposals_spec.rb
    modified:   spec/features/tags/proposals_spec.rb
    modified:   spec/models/proposal_spec.rb
2017-09-13 08:35:59 -04:00
taitus
edbbe6174b Refactor specs because now recommendations only return results asociated to user interests 2017-08-03 00:23:06 +02:00
taitus
33e13dbfd0 Add missing feature and model specs on proposal and debates. 2017-08-01 18:00:02 +02:00
Senén Rodero Rodríguez
112e0649bf Add missing proposal model specs to check new users_to_notify method. 2017-07-07 15:18:37 +02:00
Eduardo Martinez Echevarria
a600dcbb36 Replace category factory in tags with a trait 2017-06-23 17:34:55 +02:00
Bertocq
b104765ddc Rubocop autocorrect Lint/BlockAlignment and remove from rubocop_todo list 2017-06-19 10:45:18 +02:00
kikito
1701111bf5 Merge branch 'api-dev-PRs' of https://github.com/amiedes/consul into amiedes-api-dev-PRs-2 2017-06-13 12:07:28 +02:00
Bertocq
798b646135 Cleanup Settings values modified after specs are run 2017-06-07 20:55:42 +02:00
Alberto Miedes Garcés
4b7cebf686 Improved public_for_api scopes and corresponding specs 2017-01-26 18:29:59 +01:00