Sha256: f4aa6a073cea841a328879d65c771899c123734a56fa1710925a3c82f54200bf

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

require "spec_helper"

describe "when the database is not entire sharded" do
  before(:each) do
    Octopus.stub(:env).and_return("not_entire_sharded")
    OctopusHelper.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")

    OctopusHelper.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

5 entries across 5 versions & 1 rubygems

Version Path
ar-octopus-0.8.2 spec/octopus/sharded_spec.rb
ar-octopus-0.8.1 spec/octopus/sharded_spec.rb
ar-octopus-0.8.0 spec/octopus/sharded_spec.rb
ar-octopus-0.7.0 spec/octopus/sharded_spec.rb
ar-octopus-0.6.1 spec/octopus/sharded_spec.rb