Sha256: 32bd3db09fb81401357d0d14c8b0236872b0c2e4dd3afd8b149d1726768979a3

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

module Workarea
  decorate Storefront::SharingIntegrationTest, with: :one_theme do
    def test_sends_a_sharing_email
      Recaptcha.with_configuration(site_key: '12345') do
        from_email = 'bcrouse@workarea.com'
        to_email = 'bcrouse-friend@workarea.com'

        product = create_product(
          name: 'Integration Product',
          variants: [{ sku: 'SKU1', regular: 10.to_m }]
        )

        post storefront.shares_path(product),
              params: {
                url: storefront.product_url(product, host: Workarea.config.host),
                title: product.name,
                to_email: to_email,
                from_email: from_email,
                message: 'test message'
              }

        assert_redirected_to(storefront.product_path(product))

        email = ActionMailer::Base.deliveries.last

        email.parts.each do |part|
          assert_includes(part.body, product.name)
          assert_includes(part.body, 'test message')
          assert_includes(part.body, storefront.product_url(product))
        end

        assert_includes(email.to, to_email)
        assert_includes(email.from, Workarea.config.email_from)
        assert_includes(email.reply_to, from_email)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-one_theme-1.3.1 test/integration/workarea/storefront/sharing_integration_test.decorator
workarea-one_theme-1.3.0 test/integration/workarea/storefront/sharing_integration_test.decorator