Commit Graph

39 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
91c21b0982 Remove instance variables in RSpec
Instance variables might lead to hard-to-detect issues, since using a
nonexistent instance variable will return `nil` instead of raising an
error.
2019-09-30 16:43:10 +02:00
Javi Martín
7b0771106e Remove isolated useless assignments
These variables are not surrounded by other assignments, and so they can
safely be removed without making it harder to read the code vertically.
2019-09-25 12:43:44 +02:00
Javi Martín
2ec176a2a8 Remove redundant feature settings enabled in tests
These settings are enabled by default.

It could be argued explicitely enabling the features makes tests more
consistent, because they'll work if we change the default setting. It
could also be argued that it makes tests more expressive because it
makes the reader realize certain things will only work if a setting is
enabled.

However, we were only doing so in a few tests. The truth is, thousands
of our tests depend on certain features being enabled. So IMHO we should
be consistent and either set them on every test, or not at all. I'm
choosing the latter option for simplicity.
2019-09-23 15:15:51 +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
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
Juanjo Bazán
f740a868f5 fixes specs with current devise response implementation 2019-04-16 17:28:07 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Angel Perez
0b7967440f Recommendations for users are enabled by default 2018-07-15 21:28:58 -04:00
Angel Perez
0ac6033ff6 Refactor recommendations specs to improve DRYness 2018-07-15 21:28:57 -04:00
Angel Perez
4275069a1e Include tests for recommendations feature 2018-07-15 21:28:57 -04:00
rgarcia
5a041e89c4 Fix change email address
Not sure how this error creeped in 😕 probably a new gem version or
other conflicting code

The problem was we were getting an `unpermitted param email` when
updating a user’s email address

This stackoverflow solution seems to work nicely 😌
https://stackoverflow.com/questions/17384289/unpermitted-parameters-addi
ng-new-fields-to-devise-in-rails-4-0#answer-19036427
2018-04-04 14:01:51 +02:00
Bertocq
2f27a86034 Replace deprecated capybara only_path option for ignore_query 2018-01-11 00:07:56 +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
Juanjo Bazán
c4ba6a7e94 updates specs 2017-06-12 19:48:57 +02:00
Juanjo Bazán
0d9fb9e8a8 fix flaky spec 2016-12-04 00:23:19 +01:00
Juanjo Bazán
7b3c9b725c fights a flaky spec 2016-11-14 13:58:19 +01:00
rgarcia
51d688897a displays badge option if official position is level 1 2016-06-20 21:37:03 +02:00
rgarcia
98040e191e fixes conflicts with fork 2016-06-20 21:33:34 +02:00
rgarcia
28d12fe55b removes sending individual proposal notifications via email 2016-06-15 10:43:02 +02:00
rgarcia
fd67294075 adds option to receive direct messages 2016-06-14 18:20:36 +02:00
rgarcia
9f19a5d143 adds option to receive email digest 2016-06-14 18:08:27 +02:00
rgarcia
ad697cd2c1 adds preference to receive proposal notifications 2016-06-06 12:55:33 +02: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
kikito
ba32953c0e Adds test for erasing accounts 2015-10-19 20:14:20 +02:00
Juanjo Bazán
1e96bba262 refactors account's email config 2015-09-14 14:09:24 +02:00
Juanjo Bazán
b396a3b415 refactors user's registration
Simplifies process and fields: 

* In: username
* Out: first_name, last_name, phone, nickname, use_nickname?

Closes #213
2015-08-21 16:41:08 +02:00
kikito
66c8931ae9 adds account tests to increase test coverage 2015-08-17 18:31:04 +02:00
rgarcia
bea38226fe fixes spacing 2015-08-16 22:45:43 +02:00
rgarcia
a81612b226 improves consistency of error messages [#110] 2015-08-16 15:57:09 +02:00
David Gil
f835154233 adds a helper for avatars in specs 2015-08-14 21:18:35 +02:00
David Gil
c6154fe48d testing avatar presence 2015-08-14 21:16:53 +02:00
Raimond Garcia
16183d9909 Merge pull request #116 from AyuntamientoMadrid/admin-77
Administrator and Moderator basic interface
2015-08-10 16:41:47 +02:00
kikito
ce27a6f2ea Adapts AccountController to new permissions system 2015-08-10 15:10:47 +02:00
Juanjo Bazán
fefe5a12ba adds spec for failed edition of user data 2015-08-08 14:04:55 +02:00
rgarcia
3eac8d0bd8 adds email specs [#23] 2015-08-07 20:58:24 +02:00
Juanjo Bazán
8f6e5ecfc8 adds basic 'my account' page
Fields related with authentication are not included
because the auth system will change to integrate with 
Madrid.es's Ciudadano360
ref: #22
2015-07-30 17:36:32 +02:00