Sha256: 4dc504154db18b12c8970e9f7cd8d9e773fb29604f2af124a3ae77eb904871d4

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 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::RegistrationsControllerTest < ActionDispatch::IntegrationTest
  describe Overrides::RegistrationsController do
    setup do
      @existing_user  = evil_users(:confirmed_email_user)
      @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 = 1000000

      put '/evil_user_auth', {
        evil_user: {
          favorite_color: @favorite_color
        }
      }, @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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xing_backend_token_auth-0.1.32 test/controllers/overrides/registrations_controller_test.rb
xing_backend_token_auth-0.1.31 test/controllers/overrides/registrations_controller_test.rb