Sha256: 5cd120717cbb2fc279dc6fbb3c7ae0c225e2cd70e1256bdfee81ca7f625cbfc4
Contents?: true
Size: 1.99 KB
Versions: 3
Compression:
Stored size: 1.99 KB
Contents
require 'spec_helper' describe PrivatePlease::Storage::CandidatesStore do let(:candidates_store) { PrivatePlease::Storage::CandidatesStore.new } # instance methods let(:object_to_s) {PrivatePlease::Candidate.for_instance_method(Object, 'to_s' )} let(:object_hash) {PrivatePlease::Candidate.for_instance_method(Object, 'hash' )} # class methods let(:object_new ) {PrivatePlease::Candidate.for_class_method(Object, 'new' )} context 'when fresh' do it 'is empty (has no candidates)' do candidates_store .should be_empty candidates_store.instance_methods.should be_empty candidates_store.class_methods .should be_empty end end example 'storing the 1st instance method candidate stores it so that it can be retrieved' do candidates_store.store(object_to_s) candidates_store.stored?(object_to_s).should be_true candidates_store.instance_methods.should == {'Object' => mnames_for('to_s')} candidates_store.class_methods .should be_empty end example 'storing the 1st class method candidate stores it so that it can be retrieved' do candidates_store.store(object_new) candidates_store.stored?(object_new).should be_true candidates_store.instance_methods.should be_empty candidates_store.class_methods .should == {'Object' => mnames_for('new')} end example 'storing the 2nd instance method candidate stores it so that it can be retrieved' do candidates_store.store(object_to_s) candidates_store.store(object_hash) candidates_store.stored?(object_hash).should be_true candidates_store.instance_methods.should == {'Object' => mnames_for(%w(hash to_s))} candidates_store.class_methods .should be_empty end example 'storing avoids duplication' do candidates_store.store(object_to_s) candidates_store.store(object_to_s) # duplication : ignore it candidates_store.instance_methods.should == {'Object' => mnames_for(%w(to_s))} candidates_store.class_methods .should be_empty end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
private_please-0.0.5 | spec/units/candidates_store_spec.rb |
private_please-0.0.4 | spec/units/candidates_store_spec.rb |
private_please-0.0.3 | spec/units/candidates_store_spec.rb |