Sha256: 9037cf0e644d827597e3d994a65d30aeca9987e4890c7b38bfe9ec9348e6c75a

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class Custom::SessionsControllerTest < ActionController::TestCase
  describe Custom::SessionsController do
    include CustomControllersRoutes

    before do
      @existing_user = create(:user, :confirmed)
    end

    test 'yield resource to block on create success' do
      post :create,
           params: {
             email: @existing_user.email,
             password: @existing_user.password
           }
      assert @controller.create_block_called?,
             'create failed to yield resource to provided block'
    end

    test 'yield resource to block on destroy success' do
      @auth_headers = @existing_user.create_named_token_pair
      request.headers.merge!(@auth_headers)
      delete :destroy, format: :json
      assert @controller.destroy_block_called?,
             'destroy failed to yield resource to provided block'
    end

    test 'render method override' do
      post :create,
           params: { email: @existing_user.email,
                     password: @existing_user.password }
      @data = JSON.parse(response.body)
      assert_equal @data['custom'], 'foo'
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
devise_jwt_auth722-0.1.7 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth7-0.1.7 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.4.1 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.4.0 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.3.0 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.2.0 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.7 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.6 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.5 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.4 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.3 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.2 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.1 test/controllers/custom/custom_sessions_controller_test.rb
devise_jwt_auth-0.1.0 test/controllers/custom/custom_sessions_controller_test.rb