Sha256: 6950e3e747134ffbe278c2b4a9e4084c687e1c31a1fdb0ecf722a64fec996504

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

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

1 entries across 1 versions & 1 rubygems

Version Path
skanev-searchlogic-2.1.8.1 spec/named_scopes/association_ordering_spec.rb