spec/model/paths_spec.rb in her-0.6.4 vs spec/model/paths_spec.rb in her-0.6.5
- old
+ new
@@ -188,9 +188,16 @@
it "maps a single resource to a Ruby object" do
@user = Foo::User.find(1, :_organization_id => 2)
@user.id.should == 1
@user.fullname.should == "Tobias Fünke"
end
+
+ it "maps a single resource using a scope to a Ruby object" do
+ Foo::User.scope :for_organization, lambda { |o| where(:organization_id => o) }
+ @user = Foo::User.for_organization(2).find(1)
+ @user.id.should == 1
+ @user.fullname.should == "Tobias Fünke"
+ end
end
describe "fetching a collection" do
it "maps a collection of resources to an array of Ruby objects" do
@users = Foo::User.where(:_organization_id => 2).all