Sha256: 289062418cc52a31ab75bc86f8e54d67d2d011bcedb7f29d01d797e12e7bac95

Contents?: true

Size: 945 Bytes

Versions: 28

Compression:

Stored size: 945 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    class CommentMailerTest < MailerTest
      include TestCase::SearchIndexing
      include TestCase::Mail

      delegate :t, to: :I18n

      def test_notify
        Workarea.config.email_from = 'noreply@example.com'
        user = create_user
        product = create_product
        comment = product.comments.create!(body: 'test order comment')

        CommentMailer.notify(user.id, comment.id).deliver_now

        email = ActionMailer::Base.deliveries.last
        html = email.parts.second.body

        assert_includes(email.to, user.email)
        assert_includes(email.from, Workarea.config.email_from)
        assert_includes(html, comment.body)
        assert_includes(
          html,
          t(
            'workarea.admin.comment_mailer.notify.unsubscribe_from_notifications',
            commentable_name: product.name
          )
        )
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.6 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.5 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.4 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.3 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.2 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.1 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.0 test/mailers/workarea/admin/comment_mailer_test.rb
workarea-admin-3.5.0.beta.1 test/mailers/workarea/admin/comment_mailer_test.rb