Commit Graph

16 Commits

Author SHA1 Message Date
Javi Martín
5ef6c9c2b5 Simplify controller tests requiring admin login
Similar to what we did in commit 3da4ee00b for system tests.
2021-03-31 14:42:20 +02: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
9f64129be5 Remove isolated useless assignments
These variables can be considered a block, and so removing them doesn't
make the test much harder to undestand.

Sometimes these variables formed the setup, sometimes they formed an
isolated part of the setup, and sometimes they were the part of the test
that made the test different from other tests.
2019-09-30 15:47:13 +02:00
Javi Martín
9787f7f125 Remove nonexistent instance variable
The instance variable was being evaluated to `nil`, and the budget was
automatically created by the `set_denormalized_ids` method in the budget
investment class.
2019-09-29 22:52:53 +02:00
rgarcia
b628631769 fixes specs 2019-05-16 13:37:47 +02:00
rgarcia
fca7ef6cc9 removes params deprecation warning 2019-04-17 17:40:55 +02:00
rgarcia
a910eb69cd removes stats controller spec deprecation warning 2019-04-17 17:40:55 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Bertocq
633cc1283b Fix Date & DateTime parsings to use default timezone
Date.new(...) does not take into account the current timezone, while other
parts of the application do. By default always parsing any date with the
default timezone and converting the resulting Time to Date would prevent
this kind of issues

DateTime.parse(...).in_time_zone gives an unexpected result, as the
DateTime.parse(...) will create a DateTime with +0000 time zone and the
`in_time_zone` will modify the DateTime to adjust to the default zone.

Maybe its better explained with an example, using 'Lima' as timezone:

DateTime.parse("2015-01-01")
> Thu, 01 Jan 2015 00:00:00 +0000

DateTime.parse("2015-01-01").in_time_zone
> Wed, 31 Dec 2014 19:00:00 -05 -05:00

And that's not the desired date but the previous day!
2018-04-04 14:21:39 +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
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
f6fe9cc7d2 Fix all Layout/SpaceAroundOperators rubocop issues and remove file list from rubocop_todo list 2017-06-26 18:04:20 +02:00
Bertocq
d759aca522 Fix all Rails/TimeZone rubocop issues and remove files from rubocop_todo list 2017-06-25 15:46:46 +02:00
Alberto Garcia Cabeza
45af9ce5aa adds budget investments numbers and chart on admin stats 2017-04-25 16:46:20 +02:00
kikito
adc8275f5a moves the admin api inside of the /admin namespace 2015-09-24 12:11:51 +02:00