Sha256: 1616c1b129cab5f5d1aa49d77d893b940261fadcb69d3054650b2901cf7abd31

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class Custom::RefreshTokenControllerTest < ActionDispatch::IntegrationTest
  describe Custom::RefreshTokenController do
    include CustomControllersRoutes

    before do
      @resource = create(:user, :confirmed)
      @auth_headers = get_cookie_header(DeviseJwtAuth.refresh_token_name,
                                        @resource.create_refresh_token
      )
    end

    test 'yield resource to block on refresh_token success' do
      get '/nice_user_auth/refresh_token',
          params: {},
          headers: @auth_headers
      assert @controller.refresh_token_block_called?,
             'refresh_token failed to yield resource to provided block'
    end

    test 'yield resource to block on refresh_token success with custom json' do
      get '/nice_user_auth/refresh_token',
          params: {},
          headers: @auth_headers

      @data = JSON.parse(response.body)

      assert @controller.refresh_token_block_called?,
             'refresh_token failed to yield resource to provided block'
      assert_equal @data['custom'], 'foo'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise_jwt_auth-0.1.5 test/controllers/custom/custom_refresh_token_controller_test.rb
devise_jwt_auth-0.1.4 test/controllers/custom/custom_refresh_token_controller_test.rb
devise_jwt_auth-0.1.3 test/controllers/custom/custom_refresh_token_controller_test.rb
devise_jwt_auth-0.1.2 test/controllers/custom/custom_refresh_token_controller_test.rb
devise_jwt_auth-0.1.1 test/controllers/custom/custom_refresh_token_controller_test.rb
devise_jwt_auth-0.1.0 test/controllers/custom/custom_refresh_token_controller_test.rb