Sha256: c2b63537597c38678df4583595cadcc9d315fd34f6570a518f2f7d64fdbd3a51

Contents?: true

Size: 1.12 KB

Versions: 56

Compression:

Stored size: 1.12 KB

Contents

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

describe "Association Ordering" do
  it "should allow ascending" do
    Company.ascend_by_users_username.proxy_options.should == User.ascend_by_username.proxy_options.merge(:joins => :users)
  end
  
  it "should allow descending" do
    Company.descend_by_users_username.proxy_options.should == User.descend_by_username.proxy_options.merge(:joins => :users)
  end
  
  it "should allow deep ascending" do
    Company.ascend_by_users_orders_total.proxy_options.should == Order.ascend_by_total.proxy_options.merge(:joins => {:users => :orders})
  end
  
  it "should allow deep descending" do
    Company.descend_by_users_orders_total.proxy_options.should == Order.descend_by_total.proxy_options.merge(:joins => {:users => :orders})
  end
  
  it "should ascend with a belongs to" do
    User.ascend_by_company_name.proxy_options.should == Company.ascend_by_name.proxy_options.merge(:joins => :company)
  end
  
  it "should work through #order" do
    Company.order('ascend_by_users_username').proxy_options.should == Company.ascend_by_users_username.proxy_options
  end
end

Version data entries

56 entries across 56 versions & 6 rubygems

Version Path
binarylogic-searchlogic-2.1.13 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.2.0 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.2.1 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.2.2 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.2.3 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.0 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.1 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.2 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.3 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.4 spec/named_scopes/association_ordering_spec.rb
binarylogic-searchlogic-2.3.5 spec/named_scopes/association_ordering_spec.rb
kazjote-searchlogic-2.3.4 spec/named_scopes/association_ordering_spec.rb
searchlogic-donotuse-2.3.9 spec/named_scopes/association_ordering_spec.rb
aq1018-searchlogic-2.4.17 spec/named_scopes/association_ordering_spec.rb
aq1018-searchlogic-2.4.16 spec/named_scopes/association_ordering_spec.rb
aq1018-searchlogic-2.4.15 spec/named_scopes/association_ordering_spec.rb
searchlogic-2.4.14 spec/named_scopes/association_ordering_spec.rb
searchlogic-2.4.13 spec/named_scopes/association_ordering_spec.rb
searchlogic-2.4.12 spec/named_scopes/association_ordering_spec.rb
searchlogic-2.4.11 spec/named_scopes/association_ordering_spec.rb