There is no such thing as property appropriation in Ruby. In Ruby, this is all a method call. So, you are mocking the setter method, like any other method:
campaign_model.should_receive(:creationDate=).with(...)
BTW: diagnostic messages that print tests are not just for shpw. In this case, the message already tells you everything you need to know:
Spec::Mocks::MockExpectationError in 'CampaignController new campaigns should able to create new campaign when form is submitted' Mock "AdCampaign_1002" received unexpected message :creationDate= with ("2010/5/7")
As you can see, the message you sent already tells you what method name you need to find:
unexpected message :creationDate= with ("2010/5/7") ^^^^^^^^^^^^^^
source share