Sha256: b405c5b6ab391ae5e0da8461ce31c8ef06f1ac035bf4e83e18987643b07b6d04

Contents?: true

Size: 939 Bytes

Versions: 18

Compression:

Stored size: 939 Bytes

Contents

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

describe "Ordering" do
  it "should be dynamically created and then cached" do
    User.should_not respond_to(:ascend_by_username)
    User.ascend_by_username
    User.should respond_to(:ascend_by_username)
  end
  
  it "should have ascending" do
    %w(bjohnson thunt).each { |username| User.create(:username => username) }
    User.ascend_by_username.all.should == User.all(:order => "username ASC")
  end
  
  it "should have descending" do
    %w(bjohnson thunt).each { |username| User.create(:username => username) }
    User.descend_by_username.all.should == User.all(:order => "username DESC")
  end
  
  it "should have order" do
    User.order("ascend_by_username").proxy_options.should == User.ascend_by_username.proxy_options
  end
  
  it "should have priorty to columns over conflicting association columns" do
    Company.ascend_by_users_count
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
binarylogic-searchlogic-2.1.10 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.11 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.12 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.6 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.7 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.8 spec/named_scopes/ordering_spec.rb
binarylogic-searchlogic-2.1.9 spec/named_scopes/ordering_spec.rb
joost-searchlogic-2.1.7.1 spec/named_scopes/ordering_spec.rb
joost-searchlogic-2.2.3.1 spec/named_scopes/ordering_spec.rb
kazjote-searchlogic-2.1.9.3 spec/named_scopes/ordering_spec.rb
skanev-searchlogic-2.1.8.1 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.6 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.7 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.8 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.9 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.10 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.11 spec/named_scopes/ordering_spec.rb
searchlogic-2.1.12 spec/named_scopes/ordering_spec.rb