Sha256: d00acf1d4f602da1d974f2fa032b4cadd7af92f2a1af38a41060ea10b0246b3c

Contents?: true

Size: 1.15 KB

Versions: 20

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_new_auth_token
      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

20 entries across 20 versions & 6 rubygems

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