aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/support/referential.rb15
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