Displaying 1 result from an estimated 1 matches for "smsnotifier".
Did you mean:
msgnotifier
2008 May 28
3
Mocking objects to test Rails Controllers
...''m currently considering the use of Mocha to aid in writing my Rails
unit/functional tests.
I currently have a Rails model which mixes in a series of methods to
allow it to talk to an external service. The code is roughly of this form:
class Person < ActiveRecord::Base
include SMSNotifier
def send_notification(message)
send_sms(number,message)
# more code/interactions...
end
end
Assuming I want to test that a call to send_notification calls send_sms
on the SMSNotifier module, what is the best way to use Mocha to do this?
Obviously I don''t want...