Sha256: 06e47de1886ae03f7f040237b57d73f93eb76d7e36cfce63179b2653fb89ffc6

Contents?: true

Size: 746 Bytes

Versions: 24

Compression:

Stored size: 746 Bytes

Contents

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

describe Searchlogic::NamedScopes::AliasScope do
  before(:each) do
    User.alias_scope :username_has, lambda { |value| User.username_like(value) }
  end
  
  it "should allow alias scopes" do
    User.create(:username => "bjohnson")
    User.create(:username => "thunt")
    User.username_has("bjohnson").all.should == User.find_all_by_username("bjohnson")
  end
  
  it "should allow alias scopes from the search object" do
    search = User.search
    search.username_has = "bjohnson"
    search.username_has.should == "bjohnson"
  end
  
  it "should inherit alias scopes from superclasses" do
    Class.new(User).alias_scope?("username_has").should be_true
  end
end

Version data entries

24 entries across 24 versions & 7 rubygems

Version Path
searchlogic-2.4.32 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.31 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.30 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.29 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.28 spec/searchlogic/named_scopes/alias_scope_spec.rb
nberger-searchlogic-2.4.29 spec/searchlogic/named_scopes/alias_scope_spec.rb
nberger-searchlogic-2.4.28 spec/searchlogic/named_scopes/alias_scope_spec.rb
obitum-searchlogic-2.4.28 spec/searchlogic/named_scopes/alias_scope_spec.rb
rd_searchlogic-3.0.1 spec/searchlogic/named_scopes/alias_scope_spec.rb
rd_searchlogic-3.0.0 spec/searchlogic/named_scopes/alias_scope_spec.rb
rd_searchlogic-3.0.0.rc4 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.27 spec/searchlogic/named_scopes/alias_scope_spec.rb
yoomee-searchlogic-2.4.27 spec/searchlogic/named_scopes/alias_scope_spec.rb
rd_searchlogic-3.0.0.rc3 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.26 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.25 spec/searchlogic/named_scopes/alias_scope_spec.rb
rd_searchlogic-3.0.0.rc2 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.24 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.23 spec/searchlogic/named_scopes/alias_scope_spec.rb
searchlogic-2.4.22 spec/searchlogic/named_scopes/alias_scope_spec.rb