diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index 584f3fb2..cd2ee2fa 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -1,5 +1,7 @@ # Initializer to configure resque daemon -if ENV['REDIS_URL'] +if Rails.env.test? + Resque.inline = true +elsif ENV['REDIS_URL'] Resque.redis = ENV['REDIS_URL'] else puts 'WARNING: redis is not installed, so Resque is using inline method. (not recommended for production)' diff --git a/doc/SETUP_DEVELOPMENT_DOCKER.md b/doc/SETUP_DEVELOPMENT_DOCKER.md index 53c2f5bf..5f92ae3b 100644 --- a/doc/SETUP_DEVELOPMENT_DOCKER.md +++ b/doc/SETUP_DEVELOPMENT_DOCKER.md @@ -66,7 +66,7 @@ Open a rails console Setup the test database - docker-compose-dev run --rm foodsoft bundle exec rake db:setup RAILS_ENV=test DATABASE_URL=mysql2://root:secret@mariadb/test?encoding=utf8 + docker-compose-dev run --rm foodsoft bundle exec rake db:create db:schema:load RAILS_ENV=test DATABASE_URL=mysql2://root:secret@mariadb/test?encoding=utf8 Run the tests diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 10094c24..bb855f97 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -20,6 +20,7 @@ services: - REDIS_URL=redis://redis:6379 - QUEUE=foodsoft_notifier - TEST_DATABASE_URL=mysql2://root:secret@mariadb/test?encoding=utf8 + - DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true mailcatcher: image: tophfr/mailcatcher diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0e47f018..da8059ea 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -53,16 +53,6 @@ RSpec.configure do |config| config.infer_spec_type_from_file_location! end -module Faker - class Unit - class << self - def unit - ['kg', '1L', '100ml', 'piece', 'bunch', '500g'].sample - end - end - end -end - # include default foodsoft scope in urls, so that *_path works # https://github.com/rspec/rspec-rails/issues/255 class ActionDispatch::Routing::RouteSet diff --git a/spec/support/factory_girl.rb b/spec/support/factory_bot.rb similarity index 96% rename from spec/support/factory_girl.rb rename to spec/support/factory_bot.rb index 2cb72940..655548ee 100644 --- a/spec/support/factory_girl.rb +++ b/spec/support/factory_bot.rb @@ -1,4 +1,4 @@ RSpec.configure do |config| # load FactoryBot shortcuts create(), etc. config.include FactoryBot::Syntax::Methods -end \ No newline at end of file +end diff --git a/spec/support/faker.rb b/spec/support/faker.rb new file mode 100644 index 00000000..a2493870 --- /dev/null +++ b/spec/support/faker.rb @@ -0,0 +1,10 @@ +module Faker + class Unit + class << self + def unit + ['kg', '1L', '100ml', 'piece', 'bunch', '500g'].sample + end + end + end +end +