Sha256: c3a6bfeec1879fbc550b05cfa2691ffbf2da48af2fe1c8ac713a2f81ffb12695

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "when the database is not entire sharded" do
  before(:each) do
    Octopus.stub!(:env).and_return("not_entire_sharded")
    clean_connection_proxy()
  end
 
  it "should not send all queries to the specified slave" do
    pending()
    # User.create!(:name => "Thiago")
    # 
    # using_environment :not_entire_sharded do 
    #   Octopus.using(:russia) do
    #     User.create!(:name => "Thiago")
    #   end
    # end
    # 
    # User.count.should == 2
  end
  
  it "should pick the shard based on current_shard when you have a sharded model" do
    Cat.create!(:name => "Thiago")

    using_environment :not_entire_sharded do 
      Octopus.using(:russia) do
        Cat.create!(:name => "Thiago")
      end
    end
    
    Cat.count.should == 1
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ar-octopus-0.3.4 spec/octopus/sharded_spec.rb
ar-octopus-0.3.3 spec/octopus/sharded_spec.rb
ar-octopus-0.3.2 spec/octopus/sharded_spec.rb
ar-octopus-0.3.1 spec/octopus/sharded_spec.rb