Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created October 30, 2011 18:06
Show Gist options
  • Select an option

  • Save practicingruby/1326200 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/1326200 to your computer and use it in GitHub Desktop.
# Given
Match /^I have entered (\d+) into the calculator$/ do |n|
@calculator ||= Calculator.new
@calculator.push(n.to_i)
end
# When
Match /^I press add$/ do
@result = @calculator.add
end
# Then
Match /^the result should be (\d+) on the screen$/ do |n|
fail unless @result == n.to_i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment