Sha256: 198bf6bef8905af5332a687f7ea11d47a9fd321bcf9eec15f33b30836831053b
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' describe ApiResource::Finders do before(:each) do TestResource.reload_resource_definition end it "should be able to find a single object" do TestResource.connection.expects(:get).with("/test_resources/1.json") TestResource.find(1) end it "should be able to find with parameters, params syntax" do TestResource.connection.expects(:get).with("/test_resources.json?active=true") TestResource.all(:params => {:active => true}) end it "should be able to find with parameters without the params syntax" do TestResource.connection.expects(:get).with("/test_resources.json?active=true&passive=false") TestResource.all(:active => true, :passive => false) end it "should be able to chain find on top of a scope" do TestResource.connection.expects(:get).with("/test_resources.json?active=true&passive=true") TestResource.active.all(:passive => true) end it "should be able to chain find on top of an includes call" do TestResource.connection.expects(:get).with("/test_resources/1.json").returns({"id" => 1, "has_many_object_ids" => [1,2]}) HasManyObject.connection.expects(:get).with("/has_many_objects.json?ids%5B%5D=1&ids%5B%5D=2").returns([]) TestResource.includes(:has_many_objects).find(1) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api_resource-0.6.1 | spec/lib/finders_spec.rb |