test/replica_test.rb in replica-1.0.1 vs test/replica_test.rb in replica-1.0.2
- old
+ new
@@ -11,11 +11,11 @@
end
should "default to the master database" do
Account.create!
- ActiveRecord::Base.with_slave { assert_using_master_db(Account) }
+ ActiveRecord::Base.with_slave { assert_using_master_db(Account) }
Account.with_slave { assert_using_master_db(Account) }
Ticket.with_slave { assert_using_master_db(Account) }
end
should "successfully execute queries" do
@@ -34,10 +34,11 @@
assert_using_master_db(Account)
Account.create!
assert_not_equal Account.count, ActiveRecord::Base.with_slave { Account.count }
assert_not_equal Account.count, Account.with_slave { Account.count }
+ assert_not_equal Account.count, Account.with_slave.count
assert_equal Account.count, Ticket.with_slave { Account.count }
end
should "support model specific with_slave blocks" do
assert_using_master_db(Account)
@@ -65,28 +66,28 @@
assert_using_master_db(Ticket)
end
should "support conditional methods" do
assert_using_master_db(Account)
-
+
Account.with_slave_if(true) do
assert_using_slave_db(Account)
end
-
+
assert_using_master_db(Account)
Account.with_slave_if(false) do
assert_using_master_db(Account)
end
-
+
Account.with_slave_unless(true) do
assert_using_master_db(Account)
end
-
+
Account.with_slave_unless(false) do
assert_using_slave_db(Account)
end
-
+
end
should_eventually "support nested with_* blocks" do
assert_using_master_db(Account)