Sha256: 7d7a097f2c26de1c2b2d0d7fa67780d64c2ef7ecc6d5d26e6f37b97e328c8b59

Contents?: true

Size: 1.29 KB

Versions: 54

Compression:

Stored size: 1.29 KB

Contents

require 'test_helper'

#  was the web request successful?
#  was the user redirected to the right page?
#  was the user successfully authenticated?
#  was the correct object stored in the response?
#  was the appropriate message delivered in the json payload?

class Overrides::ConfirmationsControllerTest < ActionDispatch::IntegrationTest
  describe Overrides::ConfirmationsController do
    before do
      @redirect_url = Faker::Internet.url
      @new_user     = evil_users(:unconfirmed_email_user)

      # generate + send email
      @new_user.send_confirmation_instructions({
        redirect_url: @redirect_url
      })

      @mail              = ActionMailer::Base.deliveries.last
      @confirmation_path = @mail.body.match(/localhost([^\"]*)\"/)[1]

      # visit confirmation link
      get @confirmation_path

      # reload user from db
      @new_user.reload
    end

    test "user is confirmed" do
      assert @new_user.confirmed?
    end

    test "user can be authenticated via confirmation link" do
      # hard coded in override controller
      override_proof_str = "(^^,)"

      # ensure present in redirect URL
      override_proof_param = URI.unescape(response.headers["Location"].match(/override_proof=([^&]*)&/)[1])

      assert_equal override_proof_str, override_proof_param
    end
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
devise_token_auth-0.1.42 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.41 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.40 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.39 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.38 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.37 test/controllers/overrides/confirmations_controller_test.rb
xing_backend_token_auth-0.1.32 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.37.beta4 test/controllers/overrides/confirmations_controller_test.rb
cm-devise_token_auth-0.1.30.1 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.37.beta3 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.37.beta2 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.37.beta1 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.36 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.35 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.34 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.33 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.32 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.32.beta10 test/controllers/overrides/confirmations_controller_test.rb
xing_backend_token_auth-0.1.31 test/controllers/overrides/confirmations_controller_test.rb
devise_token_auth-0.1.32.beta9 test/controllers/overrides/confirmations_controller_test.rb