Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created October 11, 2010 15:18
Show Gist options
  • Save lukeredpath/620673 to your computer and use it in GitHub Desktop.
Save lukeredpath/620673 to your computer and use it in GitHub Desktop.
class SMSTester
def initialize
@number_of_sms = 0
@number_expected = 0
end
def should_have_received_message_containing
@number_expected += 1
# do something that might send an SMS
@number_of_sms_sent += # introspect this somehow?
end
end
Given /I do something that sends an SMS/ do
@sms_tester = SMSTester.new
@sms_tester.do_something
end
When /I do something again/ do
@sms_tester.do_something
end
Then /I should receive an SMS containing blah blah/ do |msg|
@sms_tester.should_have_received_message_containing(msg)
end
Then /I should not have received another SMS/ do
assert @sms_tester.number_of_sms_sent < @sms_tester.number_expected
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment