Sha256: d32112b2b7a7e22ced0ef91fd0302a9ef212072e94e0cad1fe7b6077cd26e24c

Contents?: true

Size: 1.44 KB

Versions: 8

Compression:

Stored size: 1.44 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 = SessionMailer.email_verification_email(@verification_token,
                                                   @root_url).deliver
    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 = SessionMailer.reset_password_email(@reset_email, @reset_token,
                                               @root_url).deliver
    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

8 entries across 8 versions & 1 rubygems

Version Path
authpwn_rails-0.12.0 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.11.1 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.11.0 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.10.12 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.10.11 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.10.10 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.10.9 lib/authpwn_rails/generators/templates/session_mailer_test.rb
authpwn_rails-0.10.8 lib/authpwn_rails/generators/templates/session_mailer_test.rb