From e6e15483cd302527c5bd2f495808b27af37a2864 Mon Sep 17 00:00:00 2001 From: Ilya Zhitomirskiy Date: Fri, 16 Sep 2011 13:34:35 -0700 Subject: [PATCH] more verbose testing of grouped_people --- spec/lib/hydra_wrapper_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/lib/hydra_wrapper_spec.rb b/spec/lib/hydra_wrapper_spec.rb index 45184e827..e4359eb5b 100644 --- a/spec/lib/hydra_wrapper_spec.rb +++ b/spec/lib/hydra_wrapper_spec.rb @@ -6,19 +6,19 @@ require 'hydra_wrapper' describe HydraWrapper do before do - @wrapper = HydraWrapper.new(stub, [stub, stub, stub], "", stub) + @people = ["person", "person2", "person3"] + @wrapper = HydraWrapper.new(stub, @people, "", stub) end describe 'initialize' do it 'it sets the proper instance variables' do user = "user" - people = ["person"] encoded_object_xml = "encoded xml" dispatcher_class = "Postzord::Dispatcher::Private" - wrapper = HydraWrapper.new(user, people, encoded_object_xml, dispatcher_class) + wrapper = HydraWrapper.new(user, @people, encoded_object_xml, dispatcher_class) wrapper.user.should == user - wrapper.people.should == people + wrapper.people.should == @people wrapper.encoded_object_xml.should == encoded_object_xml end end @@ -43,10 +43,9 @@ describe HydraWrapper do describe '#grouped_people' do it 'groups people given their receive_urls' do - @wrapper.people.each do |person| - @wrapper.dispatcher_class.should_receive(:receive_url_for).with(person).and_return("foo.com") - end - @wrapper.grouped_people.should == {"foo.com" => @wrapper.people} + @wrapper.dispatcher_class.should_receive(:receive_url_for).and_return("foo.com","bar.com","bar.com") + + @wrapper.grouped_people.should == {"foo.com" => [@people[0]], "bar.com" => @people[1,2]} end end