diff options
| author | Robert | 2018-01-08 21:46:28 +0100 |
|---|---|---|
| committer | Robert | 2018-01-09 12:32:19 +0100 |
| commit | 023b0e2d7a2436eb63fd0add635eaba835a57618 (patch) | |
| tree | 8ee02505027a5fb76326bf15790c3be66cbb515f /spec | |
| parent | 417465bb1c147ed1e58008516ba2f9fb7515e7a9 (diff) | |
| download | chouette-core-5506-testdb_migration_after_rollback.tar.bz2 | |
Fixes #5506@3h;5506-testdb_migration_after_rollback
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/support/referential.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 497ff47a8..fbaf5e732 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -60,7 +60,7 @@ RSpec.configure do |config| line_referential: line_referential, stop_area_referential: stop_area_referential ) - referential = FactoryGirl.create( + FactoryGirl.create( :referential, prefix: "first", name: "first", @@ -71,6 +71,19 @@ RSpec.configure do |config| ) end + # Alas this still might not be sufficiant in certain cases (interruption of tests) + # to fix the problem of `rake db:rollback; rake db:migrate`. However the test database + # can also be cleanded by means of + # ``` + # RAILS_ENV=test bundle exec ruby -I. -r config/environment.rb -e 'Referential.pluck(:slug).each{|s|Apartment::Tenant.drop(s)};Referential.delete_all'` + # + config.after :suite do + Referential.pluck(:slug).each do |name| + Apartment::Tenant.drop(name) rescue nil + end + Referential.delete_all + end + config.before(:each) do DatabaseCleaner.strategy = :transaction # Switch into the default tenant |
