Sha256: 3690d2c306fa621dd8bc75e3c90576da9e38115bc88eb09a3c62bcd77e9e3b0d

Contents?: true

Size: 1.38 KB

Versions: 28

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

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

      delegate :t, to: :I18n

      def test_report
        # create a Products Missing Images alert
        create_product(images: [], description: nil)

        Workarea.config.email_from = 'noreply@example.com'
        user = create_user(email: 'bcrouse@workarea.com')

        StatusReportMailer.report(user.email).deliver_now

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

        assert_includes(html, Workarea.config.site_name)
        assert_includes(html, t('workarea.admin.status_report_mailer.orders.total_orders'))
        assert_includes(html, t('workarea.admin.status_report_mailer.alerts.title'))
        assert_includes(html, t('workarea.admin.status_report_mailer.unsubscribe'))
        assert_includes(html, Money.default_currency.symbol)
        assert_includes(email.to, user.email)
        assert_includes(email.from, Workarea.config.email_from)
      end

      def test_report_to_many
        users = [
          create_user(email: 'bcrouse@workarea.com'),
          create_user(email: 'tscott@workarea.com')
        ]

        StatusReportMailer.report_to_many(users).map(&:deliver_now)
        assert_equal(2, ActionMailer::Base.deliveries.count)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.26 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.25 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.23 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.22 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.21 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.20 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.19 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.18 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.17 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.16 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.15 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.14 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.13 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.12 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.11 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.10 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.9 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.8 test/mailers/workarea/admin/status_report_mailer_test.rb
workarea-admin-3.5.7 test/mailers/workarea/admin/status_report_mailer_test.rb