Sha256: b6f951fc2202bfdbb31f7d99fe0e3a73f5a43c1bf5ffce9f458d0cb6861adcca
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
require "spec_helper" module Nasty describe SimpleContext do let(:sut) { SimpleContext.new(store) } let(:store) { Hash.new } context "when adding an item" do let(:key) { Key.new("artist") } let(:item) { "bobby digital" } before { sut.add(key, item) } it "should add the item to the context" do store[key.to_sym].should == item end end context "when removing an item" do let(:key) { Key.new("artist") } let(:item) { "bobby digital" } before :each do sut.add(key, item) sut.remove(key) end it "should remove the item from the store" do store[key.to_sym].should be_nil end end context "when checking if a key is in the context" do context "when it is" do let(:key) { Key.new("blah") } before { sut.add(key, 'blah') } let(:result) { sut.contains?(key) } it "should return true" do result.should be_true end end context "when it is not" do let(:key) { Key.new("blah") } let(:result) { sut.contains?(key) } it "should return false" do result.should be_false end end end context "when retrieving an item" do let(:key) { Key.new("name") } before { sut.add(key, 'mo') } let(:result) { sut.item_for(key) } it "should return the correct item" do result.should == 'mo' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nasty-0.0.1395464273 | spec/unit/simple_context_spec.rb |
nasty-0.0.1388168019 | spec/unit/simple_context_spec.rb |
nasty-0.0.1388167257 | spec/unit/simple_context_spec.rb |