Sha256: a4d3a8f5a27bf739464f6956bd632f2b2893578abdfb6abd6760a67a8d67453d
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe BlueprintsBoy::Registry do let :names do [:mock1, :mock2] end subject do described_class.new(names, nil) end describe "built" do it "should initialize built with empty set" do subject.built.should == Set.new end it "should inherit built from parent" do subject.built.add :blueprint1 child = described_class.new(names, subject) child.built.should == Set.new([:blueprint1]) end end describe "store/restore" do it "should return {} by default" do subject.restore.should == {} end it "should restore results of blueprints" do subject.store mock1: mock1, mock2: mock2 subject.restore.should == {mock1: mock1, mock2: mock2} end it "should revert changes to restored objects" do subject.store mock1: mock1, mock2: mock2 mock1 << ' has failed us' subject.restore[:mock1].should == 'mock1' end it "should restore parent objects too" do child = described_class.new([], subject) subject.store mock1: mock1 child.store mock2: mock2 child.restore.should == {mock1: mock1, mock2: mock2} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blueprints_boy-1.0.0 | spec/unit/registry_spec.rb |