spec/support/setup.rb in apartment-1.0.2 vs spec/support/setup.rb in apartment-1.1.0

- old
+ new

@@ -12,18 +12,19 @@ # any before/after hooks defined in individual tests # Otherwise these actually get run after test defined hooks around(:each) do |example| def config - db = example.metadata.fetch(:database, :postgresql) + db = RSpec.current_example.metadata.fetch(:database, :postgresql) Apartment::Test.config['connections'][db.to_s].symbolize_keys end # before Apartment::Tenant.reload!(config) ActiveRecord::Base.establish_connection config + Apartment::Test.reset_table_names example.run # after Rails.configuration.database_configuration = {} @@ -32,12 +33,11 @@ Apartment.excluded_models.each do |model| klass = model.constantize Apartment.connection_class.remove_connection(klass) klass.clear_all_connections! - klass.reset_table_name end - + Apartment::Test.reset_table_names Apartment.reset Apartment::Tenant.reload! end end end