Commit Graph

60 Commits

Author SHA1 Message Date
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
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +02:00
Javi Martín
e252d82cdb Apply IndentationWidth rubocop rule 2019-09-10 20:02:15 +02:00
taitus
4f52d8bf76 Verification::Residence allow to use new RemoteCensusAPI
Verification::Residence allow send params :date_of_birth and
:postal_code to CensusCaller 'call' method.
2019-07-29 13:10:09 +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
decabeza
21c6da3767 Use min age to participate setting on verification residence form 2019-03-22 16:15:48 +01:00
decabeza
0e1bf2188c Remove unused verification offices url setting 2019-03-06 13:08:35 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Javi Martín
e34a827c48 Add translations for rails date order
Not doing so caused crashes on applications which don't fall back to
English when a translation is missing.

We're adding them in a separate file so we can exclude it from crowdin
and so translators don't translate symbols as if they were words which
need translation.
2018-12-21 19:31: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
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
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
Bertocq
775da2d581 Remove all Layout/EmptyLines issues on code and file list from rubocop_todo 2017-06-28 14:12:51 +02:00
Bertocq
87e73e772c Remove all Lint/AmbiguousRegexpLiteral rubocop issues on code, and from rubocop_todo list 2017-06-19 10:45:18 +02:00
Juanjo Bazán
590a7bce44 reassigns erased user votes when returning user is verified 2017-02-09 20:20:30 +01:00
Juanjo Bazán
b2c9d5e6b0 Merge branch 'master' into polls 2017-01-03 23:04:21 +01:00
Fernando Blat
ca2370eb7c Manage offices url as a setting 2016-12-29 10:31:38 +01:00
Juanjo Bazán
ab61d94d2d changes Time.now to Time.current 2016-12-27 18:26:03 +01:00
rgarcia
6b0f8eb62b do not allow verification of deregistered accounts 2016-12-12 19:11:00 +01:00
kikito
f0b8cfd4a2 Time.now -> Time.current 2016-11-23 19:19:19 +01:00
rgarcia
bb3c4c6399 adds consistency to ruby code style
Keep a blank line before and after private
Keep a blank line before and after protected
Remove extra empty line at class body end
Remove extra blank line
Add final newline
Use 2 (not 3) spaces for indentation
Use 2 (not 4) spaces for indentation
Remove space before comma
Add space after comma
Remove trailing whitespaces
Remove unnecessary spacing
Use snake_case for variable names
Do not use then for multi-line if
Remove unused block argument - i
Use the new Ruby 1.9 hash syntax
Remove unused assignment to variable
Indent when as deep as case
Align attributes
Align end with def
2016-11-15 11:18:43 +01:00
Alberto Garcia Cabeza
702cfe13d1 Fixes specs 2016-07-06 14:47:09 +02:00
kikito
3ad5fa19e5 Fixes failing specs after adding geozones to residence verifications 2016-02-19 18:29:14 +01:00
rgarcia
d2400d0b36 makes specs for error handling more robust 2016-02-05 13:08:09 +01:00
Alberto Garcia Cabeza
2b5a184bfe Updates texts for tests 2015-10-28 14:03:02 +01:00
Alberto Garcia Cabeza
2bf6603207 Merges master and fixes conflicts 2015-10-28 12:51:23 +01:00
Alberto Garcia Cabeza
abad54d01a Updates tests with new texts 2015-10-28 12:47:51 +01:00
Juanjo Bazán
cf4f9945e8 checks letter verification code as integers 2015-10-27 19:15:01 +01:00
kikito
f08cf591b6 fixes an issue where users which requested a letter did not get the verification code set up 2015-10-21 12:08:56 +02:00
kikito
0d0806c9ae improvements in the letter verification error messages 2015-10-20 16:19:17 +02:00
kikito
20aee99bbf remove letter_sent verification 2015-10-20 13:16:40 +02:00
rgarcia
8904748ae2 fixes specs 2015-10-19 23:23:09 +02:00
rgarcia
17bb633567 adds specs 2015-10-19 22:58:54 +02:00
Alberto Garcia Cabeza
818887924a Updates test for verification 2015-10-02 17:13:34 +02:00
Juanjo Bazán
4a5dafd6e2 Merge pull request #551 from AyuntamientoMadrid/verification_tracking-500
Verification tracking
2015-09-28 20:04:15 +02:00
rgarcia
fbb5db8062 removes unnecessary address from users 2015-09-26 13:45:37 +02:00
rgarcia
efd5f11dba updates error message [#500] 2015-09-24 17:22:38 +02:00
rgarcia
3098fe3baa adds specs 2015-09-23 20:55:28 +02:00
Juanjo Bazán
c8d4a0088a removes url parsing in favor of current_path 2015-09-12 21:46:38 +02:00
Juanjo Bazán
dbdd149c06 redirects user to sms if no verified data
Fixes #433
2015-09-12 21:42:17 +02:00
Juanjo Bazán
d6c52ec866 puts organizations out of verification process 2015-09-12 18:05:51 +02:00
Juanjo Bazán
f517d7f410 adds before action for verified users 2015-09-11 16:44:52 +02:00
Juanjo Bazán
66c2813664 adds specs 2015-09-11 14:41:12 +02:00
rgarcia
abc68dc868 refactors lock tries [#279] 2015-09-10 20:26:49 +02:00
rgarcia
076f9251f5 fixes specs [#395] 2015-09-10 14:27:37 +02:00
rgarcia
44a408980b adds spec for letter verification tries [#332] 2015-09-10 11:43:48 +02:00
rgarcia
189f94f1d6 removes spec focus 2015-09-05 23:20:10 +02:00
rgarcia
17a1bedec0 removes document type from verified users query 2015-09-05 22:57:54 +02:00
rgarcia
28fd82c06e fixes specs for exact link texts 2015-09-03 13:17:26 +02:00
rgarcia
b8e35ac95f cleans up 2015-09-02 22:06:50 +02:00