Sha256: 637e0887888422517c00fa2ac9d0831bc8059e488ad2d09388eb14e18a7e18d5
Contents?: true
Size: 1.11 KB
Versions: 6
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe ConnectionManager::Shards do before(:each) do Fruit.shard_class_names("SouthernFruit") end context 'shards'do it "should return an array of results" do a = Fruit.shards do |shard| shard.first end expect(a).to be_a(Array) end it "should execute the active record methods on the the provided models" do fruit = FactoryGirl.create(:fruit) klasses = ["Fruit","SouthernFruit"] a = Fruit.shards do |shard| shard.where(:id => fruit.id).first end expect(klasses.include?(a[0].class.name)).to be_true end it "should not matter how the where statement is formated" do fruit = FactoryGirl.create(:fruit) afruit = Fruit.shards do |shard| shard.where(:id => fruit.id).first end bfruit = Fruit.shards do |shard| shard.where(['id = ?', fruit.id]).first end cfruit = Fruit.shards do |shard| shard.where('id = ?', fruit.id).first end expect((afruit == bfruit && bfruit == cfruit)).to be_true end end end
Version data entries
6 entries across 6 versions & 1 rubygems