spec/tenant_spec.rb in apartment-1.0.2 vs spec/tenant_spec.rb in apartment-1.1.0
- old
+ new
@@ -58,11 +58,11 @@
end
describe "#adapter" do
it "should load postgresql adapter" do
subject.adapter
- Apartment::Adapters::PostgresqlAdapter.should be_a(Class)
+ expect(Apartment::Adapters::PostgresqlAdapter).to be_a(Class)
end
it "raises exception with invalid adapter specified" do
subject.reload!(config.merge(adapter: 'unknown'))
@@ -75,13 +75,13 @@
before { subject.create db1 }
after { subject.drop db1 }
it 'has a threadsafe adapter' do
subject.switch!(db1)
- thread = Thread.new { subject.current.should == Apartment.default_tenant }
+ thread = Thread.new { expect(subject.current).to eq(Apartment.default_tenant) }
thread.join
- subject.current.should == db1
+ expect(subject.current).to eq(db1)
end
end
end
# TODO above spec are also with use_schemas=true
@@ -98,11 +98,11 @@
after{ subject.drop db1 }
describe "#create" do
it "should seed data" do
subject.switch! db1
- User.count.should be > 0
+ expect(User.count).to be > 0
end
end
describe "#switch!" do
@@ -119,14 +119,14 @@
subject.switch! db1
db_count = User.count + x.times{ User.create }
subject.switch! db2
- User.count.should == db2_count
+ expect(User.count).to eq(db2_count)
subject.switch! db1
- User.count.should == db_count
+ expect(User.count).to eq(db_count)
end
end
context "with excluded models" do
@@ -141,13 +141,13 @@
subject.reset # ensure we're on public schema
count = Company.count + x.times{ Company.create }
subject.switch! db1
x.times{ Company.create }
- Company.count.should == count + x
+ expect(Company.count).to eq(count + x)
subject.reset
- Company.count.should == count + x
+ expect(Company.count).to eq(count + x)
end
end
end
end
@@ -163,21 +163,21 @@
after{ subject.drop db1 }
it 'should seed from default path' do
subject.create db1
subject.switch! db1
- User.count.should eq(3)
- User.first.name.should eq('Some User 0')
+ expect(User.count).to eq(3)
+ expect(User.first.name).to eq('Some User 0')
end
it 'should seed from custom path' do
Apartment.configure do |config|
config.seed_data_file = "#{Rails.root}/db/seeds/import.rb"
end
subject.create db1
subject.switch! db1
- User.count.should eq(6)
- User.first.name.should eq('Different User 0')
+ expect(User.count).to eq(6)
+ expect(User.first.name).to eq('Different User 0')
end
end
end
end