spec/models/shard_spec.rb in switchman-1.2.35 vs spec/models/shard_spec.rb in switchman-1.2.36
- old
+ new
@@ -125,9 +125,21 @@
# called more than once
expect(counter).to be > 1
end
end
+ it "orders explicit scopes without an explicit order" do
+ scope = Shard.where(id: Shard.default)
+ scope.expects(:order).once.returns(scope)
+ Shard.with_each_shard(scope) {}
+ end
+
+ it "does not order explicit scopes that already have an order" do
+ scope = Shard.order(:id)
+ scope.expects(:order).never
+ Shard.with_each_shard(scope) {}
+ end
+
context "non-transactional" do
self.use_transactional_fixtures = false
it "should disconnect when switching among different database servers" do
User.connection