Sha256: 0d4284a72ae62bf4a2f5e81856c6fe405cc8946aac5f4e74add8bdb8f5a335ab
Contents?: true
Size: 1.34 KB
Versions: 6
Compression:
Stored size: 1.34 KB
Contents
# frozen_string_literal: true 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 include OverridesControllersRoutes describe Overrides::ConfirmationsController do before do @redirect_url = Faker::Internet.url @new_user = create(: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
6 entries across 6 versions & 1 rubygems