Test for reminder email
This commit is contained in:
parent
bc7e1840ba
commit
d34e741a18
|
@ -1,7 +1,7 @@
|
|||
<%= @hydrant.user.name.split.first %>,
|
||||
Hello <%= @hydrant.user.name.split.first %>,
|
||||
|
||||
Did you remember to shovel out <%= @hydrant.name %>, the fire hydrant you adopted at <%= @hydrant.street_address %>? If not, please shovel your hydrant as soon as possible!
|
||||
Did you remember to shovel <%= ['out', @hydrant.name, 'the'].compact.join(' ') %> fire hydrant you adopted at <%= @hydrant.street_address %>? If not, please shovel your hydrant as soon as possible!
|
||||
|
||||
If you've already shoveled out <%= @hydrant.name %>, thank you for serving your city!
|
||||
If you've already shoveled, thank you for serving your city!
|
||||
|
||||
Mayor Tom Menino
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class HydrantMailerTest < ActionMailer::TestCase
|
||||
end
|
|
@ -12,15 +12,9 @@ class PasswordsControllerTest < ActionController::TestCase
|
|||
post :create, :user => {:email => @user.email}
|
||||
assert_equal num_deliveries + 1, ActionMailer::Base.deliveries.size
|
||||
assert_response :success
|
||||
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
assert_equal [@user.email], email.to
|
||||
assert_equal "Reset password instructions", email.subject
|
||||
assert_match /Hello #{@user.email}!/, email.encoded
|
||||
assert_match /Someone has requested a link to change your password, and you can do this through the link below./, email.encoded
|
||||
assert_match /Change my password/, email.encoded
|
||||
assert_match /If you didn't request this, please ignore this email./, email.encoded
|
||||
assert_match /Your password won't change until you access the link above and create a new one./, email.encoded
|
||||
end
|
||||
|
||||
test 'should not send password reset instructions if email address is not found' do
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RemindersControllerTest < ActionController::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
setup do
|
||||
@hydrant = hydrants(:hydrant_1)
|
||||
@dan = users(:dan)
|
||||
@erik = users(:erik)
|
||||
@hydrant.user = @dan
|
||||
@hydrant.save!
|
||||
end
|
||||
|
||||
test 'should send a reminder email' do
|
||||
num_deliveries = ActionMailer::Base.deliveries.size
|
||||
post :create, :format => :json, :reminder => {:hydrant_id => @hydrant.id, :from_user_id => @erik.id, :to_user_id => @dan.id}
|
||||
assert_equal num_deliveries + 1, ActionMailer::Base.deliveries.size
|
||||
assert_response :success
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
assert_equal [@dan.email], email.to
|
||||
assert_equal "Remember to Shovel", email.subject
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue