Commit Graph

8 Commits

Author SHA1 Message Date
Javi Martín
a98c363d4d Allow seeding a specific tenant with db:dev_seed
Until now, running `db:dev_seed` created development data for the
default tenant but it was impossible to create this data for other
tenants.

Now the tenant can be provided as a parameter.

Note that, in order to be able to execute this task twice while running
the tests, we need to use `load` instead of `require_relative`, since
`require_relative` doesn't load the file again if it's already loaded.

Also note that having two optional parameters in a rake task results in
a cumbersome syntax to execute it. To avoid this, we're simply removing
the `print_log` parameter, which was used mainly for the test
environment. Now we use a different logic to get the same result.

From now on it won't be possible to pass the option to avoid the log in
the development environment. I don't know a developer who's ever used
this option, though, and it can always be done using `> /dev/null`.
2022-11-09 18:19:20 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Javi Martín
1a5b73a0bd Don't load tasks several times in specs
Calling `load_tasks` in several files made rails load the tasks several
times, and so they were executed several times when called.

Since the milestone migration can't be executed twice in a row (it would
fail with duplicated ID records), loading the tasks several times made
the milestone migrations task specs fail.
2018-11-30 14:15:21 +01:00
Bertocq
fcdc24a78c Avoid db:dev_seed log print when run from its test
The db:dev_seed rake logs info as it progresses as information for the
developer. But that's not needed when ran from its tests file, and it
bloats the travis/rspec output with unnecessary information.

Now the task will always log info unless the rake task receives an
optional argument.
2018-04-14 20:28:43 +02:00
Angel Perez
80b77e873e Add missing require for dev_seeds rake task spec 2018-03-06 18:47:57 -04:00
rgarcia
e456f5fc1c Remove duplicate dev_seed execution 2018-01-22 17:40: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
Angel Perez
cd8d1706f9 Add spec for 'rake db:dev_seed' task 2017-12-18 08:59:39 -04:00