Sha256: 59a15fbd95b5488a5c09b83b4ab534e84cb743bfd0d38e4514c62627eea7eac7

Contents?: true

Size: 1.28 KB

Versions: 14

Compression:

Stored size: 1.28 KB

Contents

require 'test_helper'

module PointlessFeedback
  class FeedbackMailerTest < ActionMailer::TestCase
    before do
      PointlessFeedback.to_emails = 'to@example.com'

      @message = FactoryGirl.create(:message)
      @mail    = FeedbackMailer.feedback(@message)
    end

    test "feedback email" do
      assert_equal "Feedback", @mail.subject
      assert_equal ["to@example.com"], @mail.to
      assert_equal ["feedback@pointlesscorp.com"], @mail.from
    end

    test "feedback email body" do
      assert_match "You've got feedback!", @mail.body.encoded
      assert_match "Name: #{@message.name}", @mail.body.encoded
      assert_match "Email Address: #{@message.email_address}", @mail.body.encoded
      assert_match "Topic: #{@message.topic}", @mail.body.encoded
      assert_match "Description: #{@message.description}", @mail.body.encoded
    end

    test "feedback from email when set" do
      PointlessFeedback.from_email = 'from@example.com'
      @mail = FeedbackMailer.feedback(@message)

      assert_equal 'from@example.com', @mail.from.first
    end

    test "feedback from email when set as the sender" do
      PointlessFeedback.send_from_submitter = true
      @mail = FeedbackMailer.feedback(@message)

      assert_equal @message.email_address, @mail.from.first
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pointless_feedback-4.1.4 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.1.3 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.1.2 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.1.1 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.1.0 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.6 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.5 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.3 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.2 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-3.0.2 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.1 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-3.0.0 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-4.0.0 test/functional/pointless_feedback/feedback_mailer_test.rb
pointless_feedback-1.0.3 test/functional/pointless_feedback/feedback_mailer_test.rb