Commit Graph

22 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
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
Javi Martín
da59315530 Don't show links to budget results if disabled 2019-06-06 12:18:05 +02:00
Julian Herrero
b122302c58 Use find instead of find_by_id
Better raise a 404 HTML NotFound exception than any other unexpected error.
2019-06-03 17:54:19 +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
Javi Martín
e3d6dbacab Simplify finished budget factory creation 2019-05-22 11:50:03 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
0bf31bde6c Updates all active to is-active classes 2018-06-06 12:02:13 +02:00
Bertocq
66691b644a Refactor Budget::PHASES constant to Budget::Phase::PHASE_KINDS 2018-01-16 12:18:13 +01:00
Bertocq
2c3d8e9fd5 Avoid creating a budget in drafting phase to test results access 2018-01-09 01:16:09 +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
2d355ce938 Enable RSpec/LetSetup cop & fix issues
Read more about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
2018-01-07 16:23:49 +01:00
Bertocq
705ef19f6d Improvements on budget results view & table 2017-07-17 20:19:54 +02:00
rgarcia
c0d3ccaf46 Adds specs for loading first heading 2017-07-13 12:37:14 +02:00
Bertocq
11a793d63f Hide incompatible and non-winner investments by default 2017-07-10 19:43:55 +02:00
Bertocq
2fba9de33b Don't display incompatible investment's table if empty 2017-07-10 17:12:28 +02:00
Bertocq
10b17eae8f Update user budget's result feature spec to include incompatible ones 2017-07-04 02:14:54 +02:00
Eduardo Martinez Echevarria
1802202033 Add test to check that results of unfinished budgets are inaccessible 2017-06-11 23:29:56 +02:00
decabeza
5e276175f1 updates texts on specs 2017-05-19 18:49:00 +02:00
rgarcia
0b68f3c619 cleans up 2017-05-19 14:07:30 +02:00
rgarcia
65eb2bb160 adds budget result specs 2017-05-19 14:04:46 +02:00