2011-06-18 20:54:22 +00:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class RemindersControllerTest < ActionController::TestCase
|
2011-06-29 19:04:49 +00:00
|
|
|
setup do
|
2011-09-15 21:41:26 +00:00
|
|
|
@thing = things(:thing_1)
|
2011-06-29 19:04:49 +00:00
|
|
|
@dan = users(:dan)
|
|
|
|
@erik = users(:erik)
|
2011-09-15 21:41:26 +00:00
|
|
|
@thing.user = @dan
|
|
|
|
@thing.save!
|
2011-06-29 19:04:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'should send a reminder email' do
|
|
|
|
num_deliveries = ActionMailer::Base.deliveries.size
|
2011-09-15 21:41:26 +00:00
|
|
|
post :create, :format => :json, :reminder => {:thing_id => @thing.id, :from_user_id => @erik.id, :to_user_id => @dan.id}
|
2011-06-29 19:04:49 +00:00
|
|
|
assert_equal num_deliveries + 1, ActionMailer::Base.deliveries.size
|
|
|
|
assert_response :success
|
|
|
|
email = ActionMailer::Base.deliveries.last
|
|
|
|
assert_equal [@dan.email], email.to
|
2011-10-10 21:10:01 +00:00
|
|
|
assert_equal "Remember to shovel", email.subject
|
2011-06-29 19:04:49 +00:00
|
|
|
end
|
2011-06-18 20:54:22 +00:00
|
|
|
end
|