Sha256: 6c3cc53271e70ae84b15db693ca18bc08fd0124f06487e190234c927cd4375a8
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
require File.dirname(__FILE__)+'/spec_helper' include Restfully describe Collection do it "should have all methods of a hash" do collection = Collection.new("uri", session=mock('session')) collection.size.should == 0 collection.store("rennes", resource = mock(Resource)) collection.size.should == 1 collection.should == {'rennes' => resource} collection.should respond_to(:each) collection.should respond_to(:store) collection.should respond_to(:[]) collection.should respond_to(:length) end it "should not load if already loaded and no force_reload" do collection = Collection.new("uri", mock("session")) collection.should_receive(:loaded?).and_return(true) collection.load(:reload => false).should == collection end it "should load when force_reload is true [already loaded]" do collection = Collection.new("uri", session=mock("session", :logger => Logger.new(STDOUT))) collection.should_receive(:loaded?).and_return(true) session.should_receive(:get).and_return({}) collection.load(:reload => true).should == collection end it "should load when force_reload is true [not loaded]" do collection = Collection.new("uri", session=mock("session", :logger => Logger.new(STDOUT))) collection.should_receive(:loaded?).and_return(false) session.should_receive(:get).and_return({}) collection.load(:reload => true).should == collection end it "should force reload when query parameters are given" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crohr-restfully-0.0.0 | spec/collection_spec.rb |
crohr-restfully-0.1.1 | spec/collection_spec.rb |