Sha256: 4f9f843190f8bdd617f5dc8ecc81df1985d195aff4e9940f0250ee09e4064ffe

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 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::RegistrationsControllerTest < ActionDispatch::IntegrationTest
  include OverridesControllersRoutes

  describe Overrides::RegistrationsController do
    describe 'Succesful Registration update' do
      before do
        @existing_user  = create(:user, :confirmed)
        @auth_headers   = @existing_user.create_new_auth_token
        @client_id      = @auth_headers['client']
        @favorite_color = 'pink'

        # ensure request is not treated as batch request
        age_token(@existing_user, @client_id)

        # test valid update param
        @new_operating_thetan = 1_000_000

        put '/evil_user_auth',
            params: { favorite_color: @favorite_color },
            headers: @auth_headers

        @data = JSON.parse(response.body)
        @existing_user.reload
      end

      test 'user was updated' do
        assert_equal @favorite_color, @existing_user.favorite_color
      end

      test 'controller was overridden' do
        assert_equal Overrides::RegistrationsController::OVERRIDE_PROOF,
                     @data['override_proof']
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 6 rubygems

Version Path
devise_token_auth-1.2.4 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.2.2 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.2.1 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.2.0 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.5 test/controllers/overrides/registrations_controller_test.rb
sidecar_token_auth-1.0.1 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.4 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth_multitenancy-1.1.3.2 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth_multitenancy-1.1.3.1 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth_multitenancy-1.1.3.alpha1 test/controllers/overrides/registrations_controller_test.rb
devise-tokens-1.0.4 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.3 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.2 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.1 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.1.0 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth_fork_dfabarbosa-1.0.0 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth_skycocker_fork-1.0.0 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.0.0 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.0.0.rc2 test/controllers/overrides/registrations_controller_test.rb
devise_token_auth-1.0.0.rc1 test/controllers/overrides/registrations_controller_test.rb