Think I may draw a line under this for now. The latest (& getting very
hacky) expectation looks like this:

    it "should generate a new property with each set of params" do
      @params.reduce( Property.should_receive( :new ).ordered ) do
|expectation, param|
        expectation.with( param )
      end.
        and_return( *...@properties )

      do_call
    end

which gives this error:

  <Property(Table doesn't exist) (class)> expected :new with
({:property_holly_id__c=>"10"}) but received it with
([{:property_holly_id__c=>"1"}], [{:property_holly_id__c=>"2"}],
[{:property_holly_id__c=>"3"}], [{:property_holly_id__c=>"4"}],
[{:property_holly_id__c=>"5"}], [{:property_holly_id__c=>"6"}],
[{:property_holly_id__c=>"7"}], [{:property_holly_id__c=>"8"}],
[{:property_holly_id__c=>"9"}])

This suggests mismatched arrays, but when I change the first line of the
expectation to this:

      @params[0..-2].reduce( Property.should_receive( :new ).ordered ) do
|expectation, param|

The error then is:

  <Property(Table doesn't exist) (class)> expected :new with
({:property_holly_id__c=>"9"}) but received it with
([{:property_holly_id__c=>"1"}], [{:property_holly_id__c=>"2"}],
[{:property_holly_id__c=>"3"}], [{:property_holly_id__c=>"4"}],
[{:property_holly_id__c=>"5"}], [{:property_holly_id__c=>"6"}],
[{:property_holly_id__c=>"7"}], [{:property_holly_id__c=>"8"}],
[{:property_holly_id__c=>"10"}])


Which suggests that the final item in @params that gets passed in is not
being read. A debug puts of the items as they are used in the method shows
that all are, in fact, being used.
Damn'ed if I know! ;)
Thanks again for all your input -- I've now got blocks in stubs to play
with!
   Doug.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to