diff --git a/.rspec b/.rspec index 43ae20365..83c8466f5 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,3 @@ --color ---require spec_helper +--require rails_helper --format documentation diff --git a/TESTING.md b/TESTING.md index a4ae47318..dc67f4f35 100644 --- a/TESTING.md +++ b/TESTING.md @@ -18,10 +18,19 @@ For more information visit [cypress-documentation](https://docs.cypress.io) and ## In docker development container +Start the development version as usual. All commands are executed +in `docker/development` + Make sure that the seperate test db exist: ```sh docker-compose exec mampf sh -c "RAILS_ENV=test rails db:create" docker-compose exec mampf sh -c "RAILS_ENV=test rails db:migrate" + docker-compose exec mampf sh -c "RAILS_ENV=test rails db:test:prepare" ``` +Now you can run the tests: + +```sh +docker-compose exec mampf sh -c "RAILS_ENV=test rails spec" +``` diff --git a/config/sunspot.yml b/config/sunspot.yml index 8ee20a15e..29b5febaa 100644 --- a/config/sunspot.yml +++ b/config/sunspot.yml @@ -26,5 +26,5 @@ test: hostname: <%= ENV.fetch('SOLR_HOST', 'solr') %> port: <%= ENV.fetch('SOLR_PORT', '8983') %> log_level: WARNING - path: <%= ENV.fetch('SOLR_PATH', '/solr/test') %> + path: <%= ENV.fetch('SOLR_TEST_PATH', '/solr/test') %> diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 144991f3a..4728d918e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,6 +1,5 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' -ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f9cccb970..4368ebb02 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +ENV['RAILS_ENV'] ||= 'test' #simplecov require 'simplecov'