spec/slavery_spec.rb in slavery-1.1.1 vs spec/slavery_spec.rb in slavery-1.2.0
- old
+ new
@@ -51,9 +51,17 @@
Slavery.stub(:disabled).and_return(true)
Slavery.on_slave { User.slaveryable?.should == false }
end
+ it 'works with scopes' do
+ User.count.should == 2
+ User.on_slave.count.should == 1
+
+ User.scoped.to_a.size.should == 2
+ User.on_slave.scoped.to_a.size.should == 1
+ end
+
describe 'configuration' do
before do
# Backup connection and configs
@old_conn = User.instance_variable_get :@slave_connection_holder
@old_config = ActiveRecord::Base.configurations.dup