Created
January 30, 2012 03:25
-
-
Save kirkbushell/1702294 to your computer and use it in GitHub Desktop.
rspec mock issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
describe UserMailer do | |
describe "registration_email" do | |
@user = mock_model(User, :email => 'some@email.com', :first_name => 'john') | |
let(:mail) { UserMailer.registration_email(@user) } | |
it "renders the headers" do | |
mail.subject.should eq("Welcome to ScreenZone!") | |
mail.to.should eq([@user.email]) | |
mail.from.should eq(["support@screenzone.com"]) | |
end | |
it "renders the body" do | |
mail.body.encoded.should match("<p>Welcome to Screenzone, #{@user.first_name}</p>") | |
end | |
end | |
end |
or,
let(:user) { mock_model(User, :email => 'some@email.com', :first_name => 'john') }
and change instances of @user to user
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should be: