Skip to content

Instantly share code, notes, and snippets.

@phinze
Created December 30, 2009 19:51
Show Gist options
  • Save phinze/266335 to your computer and use it in GitHub Desktop.
Save phinze/266335 to your computer and use it in GitHub Desktop.
Feature: Dashboard
In order to not explode from frustration
a developer
does not want rspec stubs to leak between scenarios
Scenario: Create a stub
When I stub nap time to "When I Get Cranky"
Then nap time should be "When I Get Cranky"
Scenario: Check to see if the stub leaked
Then nap time should not be defined
When /^I stub nap time to "([^\"]*)"$/ do |value|
Time.stub!(:nap).and_return(value)
end
Then /^nap time should be "([^\"]*)"$/ do |value|
Time.nap.should == value
end
Then /^nap time should not be defined$/ do
lambda {
Time.nap
}.should raise_error(NoMethodError)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment