Displaying 1 result from an estimated 1 matches for "existing_quote_number".
Did you mean:
existing_quote_numbers
2008 Mar 05
7
mocking successive return values
...ate_quote_number
end
quote_num
end
def random_string(size=8)
# 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 quot...