Sha256: a81045969b1a2cdbc9c1369f5cc81c2ade305d5e0125388438e47fc70f799850

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

require 'test_helper'

class SessionMailerTest < ActionMailer::TestCase
  setup do
    @reset_email = credentials(:jane_email).email
    @reset_token = credentials(:jane_password_token)
    @verification_token = credentials(:john_email_token)
    @verification_email = credentials(:john_email).email
    @root_url = 'hxxp://test.host/'
  end

  test 'email verification email' do
    email_draft = SessionMailer.email_verification_email @verification_token,
                                                         @root_url
    email = email_draft.deliver_now
    assert !ActionMailer::Base.deliveries.empty?

    assert_equal 'test.host e-mail verification', email.subject
    assert_equal ['admin@test.host'], email.from
    assert_equal '"test.host staff" <admin@test.host>', email['from'].to_s
    assert_equal [@verification_email], email.to
    assert_match @verification_token.code, email.encoded
    assert_match @root_url, email.encoded
  end

  test 'password reset email' do
    email_draft = SessionMailer.reset_password_email @reset_email,
                                                     @reset_token, @root_url
    email = email_draft.deliver_now
    assert !ActionMailer::Base.deliveries.empty?

    assert_equal 'test.host password reset', email.subject
    assert_equal ['admin@test.host'], email.from
    assert_equal '"test.host staff" <admin@test.host>', email['from'].to_s
    assert_equal [@reset_email], email.to
    assert_match @reset_token.code, email.encoded
    assert_match @root_url, email.encoded
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authpwn_rails-0.23.0 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.22.1 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.22.0 lib/authpwn_rails/generators/templates/session_mailer_test.rb