docbrown/spec/support/database_cleaner.rb
Nick Taylor 15601285a5
Add data cleaning pre-test run to end to end tests (#12001)
* Added the cypress-on-rails gem.

* Removed secret from admin login fixture data and promoted it to Cypress config.

* Created resetData task for tests.

* Now the spec resets data on each test run.

* Removed the cypress-on-rails gem.

* Added node-fetch for e2e testing.

* Move rresetData to async/await.

* Small refactor to resetData Cypress task.

* Now there is a cypress.dev.json config for local dev testing.

* Added rails assets:precompile instead of webpacker:compile.

* Added more explicit error if Elastic Search fails to clear.

* Exposing more explicit error for truncating DB.

* Added better error output for truncating the DB.

* Removed stdout from error logging as it's empty.

* Reworked error message.

* Implemented @rhymes suggestions for fixing trunctation in the test environment.

* Removed unused Cypress configuration file.
2020-12-26 16:58:12 +01:00

7 lines
186 B
Ruby

require "database_cleaner-active_record"
RSpec.configure do |config|
config.after(:each, db_strategy: :truncation) do |_example|
DatabaseCleaner.clean_with(:truncation)
end
end