Sha256: 17a505124b2b17843a2a5bb681eb471047a5b731d344380e6b66ab42ab93b248
Contents?: true
Size: 1.46 KB
Versions: 15
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' class Recipe < StorageRoom::Entry key :name end describe StorageRoom::IdentityMap do before(:each) do @response_data = {'@url' => 'URL', '@type' => 'Recipe', 'name' => 'NAME'} @recipe = Recipe.new_from_response_data(@response_data) end context "Module Methods" do describe "#models" do it "should return set" do set = StorageRoom::IdentityMap.models set.should be_an_instance_of(Set) set.should include(StorageRoom::Resource) end end describe "#clear" do it "should remove objects" do StorageRoom::Resource.identity_map['URL'] = 1 StorageRoom::Resource.identity_map.should have(1).item StorageRoom::IdentityMap.clear StorageRoom::Resource.identity_map.should have(0).items end end end context "Class Methods" do describe "#new_from_response_data" do it "should return existing object from identity map" do response_data = {'@url' => 'URL', '@type' => 'Recipe'} recipe = Recipe.new_from_response_data(response_data) recipe.should == @recipe recipe.name.should == 'NAME' end it "should return new object" do response_data = {'@url' => 'URL2', '@type' => 'Recipe', 'name' => 'NAME2'} recipe = Recipe.new_from_response_data(response_data) recipe.should_not == @recipe recipe.name.should == 'NAME2' end end end end
Version data entries
15 entries across 15 versions & 1 rubygems