Hi
Just wrote myself a Date.extract_from_rails_hash to handle parsing
the "date(1i)", "date(2i)" parameters created in the controller
params. I've got a method that needs to call this either once or
twice, depending on the contents of the form (one section of the form
is rendered conditionally). So I had two specs for the case where
the second form section is included:
it "..." do
Date.should_receive(:extract_from_rails_hash).
with(REQUEST_ARGS_WITH_FINANCE_AGREEMENT
[:vehicle], :registration_date).
and_return(Date.new(2006, 12, 1))
# ...
end
it "..." do
Date.should_receive(:extract_from_rails_hash).
with(REQUEST_ARGS_WITH_FINANCE_AGREEMENT
[:finance_agreement], :start_date).
and_return(Date.new(2006, 12, 4))
# ...
end
In each of these specs I only care about one of the calls, but they
fail because the Date method is being called twice, and it reports
the other call as an error.
What is the thinking behind this? I know you shouldn't have
unspecified code, but it seems restrictive to force all calls to a
method to be covered in the same example.
Thanks
Ashley
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users