Last active
December 11, 2015 21:59
-
-
Save gma/4666549 to your computer and use it in GitHub Desktop.
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
the 'create action' do | |
def post_create(params = {}) | |
post :create, invitation: params | |
end | |
def valid_params | |
{ email: 'user@domain.com', first_name: 'First', last_name: 'Last' } | |
end | |
it 'should send an email to invite new users' do | |
assert_difference 'ActionMailer::Base.deliveries.size' do | |
post_create valid_params | |
end | |
end | |
# lots of other tests removed for clarity | |
end |
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
an 'Account invitation email' do | |
before do | |
@code = Invitation.generate_code | |
invitation = build( | |
:invitation, kind: 'account', email: @email, code: @code) | |
@message = SignupMailer.account_invite(invitation).deliver | |
end | |
it 'should be sent to the invitee' do | |
assert_equal [@email], @message.to | |
assert_equal 'Invite code for The Agile Planner', @message.subject | |
end | |
it 'should contain a link to the signup page' do | |
assert_match %r{com/signup\?code=#{@code}}, @message.encoded | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment