spec/examples/generic_adapter_examples.rb in apartment-0.15.0 vs spec/examples/generic_adapter_examples.rb in apartment-0.16.0
- old
+ new
@@ -1,12 +1,12 @@
require 'spec_helper'
shared_examples_for "a generic apartment adapter" do
include Apartment::Spec::AdapterRequirements
-
+
before{ Apartment.prepend_environment = false }
-
+
#
# Creates happen already in our before_filter
#
describe "#create" do
@@ -18,35 +18,35 @@
it "should load schema.rb to new schema" do
subject.process(db1) do
connection.tables.should include('companies')
end
end
-
+
it "should yield to block if passed and reset" do
subject.drop(db2) # so we don't get errors on creation
@count = 0 # set our variable so its visible in and outside of blocks
subject.create(db2) do
@count = User.count
subject.current_database.should == db2
User.create
end
-
+
subject.current_database.should_not == db2
subject.process(db2){ User.count.should == @count + 1 }
- end
+ end
end
-
+
describe "#drop" do
it "should remove the db" do
subject.drop db1
database_names.should_not include(db1)
- end
+ end
end
-
+
describe "#process" do
it "should connect" do
subject.process(db1) do
subject.current_database.should == db1
end
@@ -65,11 +65,11 @@
expect {
subject.process(db1){ subject.drop(db2) }
}.to_not raise_error
end
end
-
+
describe "#reset" do
it "should reset connection" do
subject.switch(db1)
subject.reset
subject.current_database.should == default_database
@@ -83,10 +83,10 @@
end
it "should reset connection if database is nil" do
subject.switch
subject.current_database.should == default_database
- end
+ end
end
describe "#current_database" do
it "should return the current db name" do
subject.switch(db1)
\ No newline at end of file