Sha256: 07e12aca78808a5705463d95e4d7d7df3a6ee5613a9427f8fa6fc2e726b87748
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' module Rambling module Trie describe ChildrenHashDeferer do class ClassWithChildren include ChildrenHashDeferer attr_accessor :children def initialize() @children = {} end end let(:deferer) { ClassWithChildren.new } describe '#[]' do let(:key) { :key } let(:value) { 'value' } it 'defers to the children hash' do deferer.children.should_receive(:[]).with(key).and_return value deferer[key].should == value end end describe '#[]=' do let(:key) { :key } let(:value) { 'value' } it 'defers to the children hash' do deferer.children.should_receive(:[]=).with(key, value) deferer[key] = value end end describe '#delete' do let(:key) { :key } let(:value) { 'value' } it 'defers to the children hash' do deferer.children.should_receive(:delete).with(key).and_return value deferer.delete(key).should == value end end describe '#has_key' do let(:key) { :key } it 'defers to the children hash' do [true, false].each do |value| deferer.children.should_receive(:has_key?).with(key).and_return value deferer.has_key?(key).should send("be_#{value}") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rambling-trie-0.4.2 | spec/lib/rambling/trie/children_hash_deferer_spec.rb |
rambling-trie-0.4.1 | spec/lib/rambling-trie/children_hash_deferer_spec.rb |