Skip to content

Instantly share code, notes, and snippets.

@sumeet
Created February 21, 2012 02:19
Show Gist options
  • Save sumeet/1873066 to your computer and use it in GitHub Desktop.
Save sumeet/1873066 to your computer and use it in GitHub Desktop.
describe MyClass do
it "retrieves data from the data store" do
data = stub
# should_receive would be redundant here because the assertion confirms
# data was passed through.
DataStore.stub!(:find_data).and_return(data)
subject.data.should == data
end
it "sends an email to the user" do
email_address = stub
# should_receive is necessary here because we're not looking for data to
# be passed through.
Welcomer.should_receive(:send_welcome_email).with(email_address)
subject.add_user(email_address)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment