Sha256: e2dd727bca99ba4224f95080a9be8c1957a85b09ff4f5f7c4623e404310ac96c

Contents?: true

Size: 747 Bytes

Versions: 10

Compression:

Stored size: 747 Bytes

Contents

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

describe Octopus::ScopeProxy do
  it "should allow nested queries" do
    @user1 = User.using(:brazil).create!(:name => "Thiago P", :number => 3)
    @user2 = User.using(:brazil).create!(:name => "Thiago", :number => 1)
    @user3 = User.using(:brazil).create!(:name => "Thiago", :number => 2)
    
    User.using(:brazil).where(:name => "Thiago").where(:number => 4).order(:number).all.should == []
    User.using(:brazil).where(:name => "Thiago").using(:canada).where(:number => 2).using(:brazil).order(:number).all.should == [@user3]
    User.using(:brazil).where(:name => "Thiago").using(:canada).where(:number => 4).using(:brazil).order(:number).all.should == []
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ar-octopus-0.0.19 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.18 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.16 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.15 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.14 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.13 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.12 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.11 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.10 spec/octopus/scope_proxy_spec.rb
ar-octopus-0.0.9 spec/octopus/scope_proxy_spec.rb