Displaying 1 result from an estimated 1 matches for "policy_service".
Did you mean:
_policy_service
2008 Mar 05
7
mocking successive return values
...# return a random string
end
For the test, I simply lookup 3 existing quote numbers, append nil to
the end (for a total of 4)
## The test
it "should not generate a duplicate quote number" do
existing_quote_numbers = Policy.find(:all).map{|p| p.quote_number}
[0,3]
@policy_service
.should_receive
(:random_string
).with
(:no_args
).exactly(4).times.and_return(existing_quote_numbers.concat([nil]))
@policy_service.generate_quote_number
end
## The result
should not generate a duplicate quote number
Mock ''Service::Base'' expected :random_string wit...