Sha256: e42517c33c38b199766fd475fe5a5bf8e5ef2d3cdf0df669a2de376ee148e6f6
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe EdgeRider::OriginClass do describe '#origin_class' do it "should return the class a scope is based on" do Forum.create!(:id => 1) Forum.create!(:id => 2) scope = Forum.scoped(:conditions => { :id => [1] }) scope.origin_class.should == Forum scope.origin_class.collect_ids.should == [1, 2] end it "should return the class a scope chain is based on" do Forum.create!(:id => 1, :name => 'A') Forum.create!(:id => 2, :name => 'B') Forum.create!(:id => 3, :name => 'C') scope_chain = Forum.scoped(:conditions => { :id => [1, 2] }).scoped(:conditions => { :name => ['A', 'B'] }) scope_chain.origin_class.should == Forum scope_chain.origin_class.collect_ids.should == [1, 2, 3] end it "should return itself when called on an ActiveRecord class" do Forum.create!(:id => 1) Forum.create!(:id => 2) Forum.origin_class.should == Forum Forum.origin_class.collect_ids.should == [1, 2] end end end
Version data entries
5 entries across 5 versions & 1 rubygems