Sha256: 5087e9d2c9f05e2ccccdd29e7b304afc450c5ffc7775c605b453bda3cab1c46d

Contents?: true

Size: 1.22 KB

Versions: 17

Compression:

Stored size: 1.22 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'friend_mailer'

class FriendMailerTest < ActiveSupport::TestCase

  context "deliver emails" do

    def setup
      ActionMailer::Base.delivery_method = :test
      ActionMailer::Base.perform_deliveries = true
      ActionMailer::Base.deliveries = []
      @expected = TMail::Mail.new
      @expected.set_content_type "text", "plain", { "charset" => 'utf-8' }
    end
    
    should "send follow email" do
      inviter = Factory(:user)
      invited = Factory(:user)
      response = FriendMailer.deliver_follow(inviter, invited)
      assert !ActionMailer::Base.deliveries.empty?, "No email was sent"
      email = ActionMailer::Base.deliveries.last
      assert_equal [invited.email], email.to
      assert_equal [GlobalConfig.from_email], email.from
    end
    
    should "send friend_request email" do
      inviter = Factory(:user)
      invited = Factory(:user)
      response = FriendMailer.deliver_friend_request(inviter, invited)
      assert !ActionMailer::Base.deliveries.empty?, "No email was sent"
      email = ActionMailer::Base.deliveries.last
      assert_equal [invited.email], email.to
      assert_equal [GlobalConfig.from_email], email.from
    end
    
  end  
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
muck-friends-0.1.17 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.16 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.15 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.14 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.13 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.12 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.11 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.10 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.5 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.6 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.7 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.8 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.9 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.1 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.2 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.3 test/rails_root/test/unit/friend_mailer_test.rb
muck-friends-0.1.4 test/rails_root/test/unit/friend_mailer_test.rb