Sha256: 06a18d7518ff99a98b8faa088d14356e236691ab36c36f9c4d8bc44bf8a803e5

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 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, "BAhbCUkiFXRlc3RAZXhhbXBsZS5vcmcGOgZFVDAwMA==--f435e91ba90e1732d3e999af1f2126dcc8182a5d"
    text_body = message.text_part.body.to_s
    assert_includes text_body, "BAhbCUkiFXRlc3RAZXhhbXBsZS5vcmcGOgZFVDAwMA==--f435e91ba90e1732d3e999af1f2126dcc8182a5d"
  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.0 test/mailkick_test.rb