Sha256: 2e71669d92a6170b43ab1ffd6306d44d83f1a4f06c13eb526d0d31c1e3af9c8d

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

require_relative "test_helper"

class MailkickTest < Minitest::Test
  def test_unsubscribe_url
    message = UserMailer.welcome.deliver_now
    html_body = message.html_part.body.to_s
    assert_includes html_body, "unsubscribe"
    text_body = message.text_part.body.to_s
    assert_includes text_body, "unsubscribe"
  end

  def test_opt_out
    email = "test2@example.org"
    user = User.create!(email: email)

    Mailkick.opt_out(email: email, user: user)

    opt_outs = Mailkick::OptOut.all.to_a
    assert_equal 1, opt_outs.size

    opt_out = opt_outs.first
    assert_equal email, opt_out.email
    assert_equal user, opt_out.user

    assert user.opted_out?
    assert_equal 1, User.opted_out.count
    assert_equal 0, User.not_opted_out.count
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailkick-0.3.1 test/mailkick_test.rb