diff --git a/Gemfile.lock b/Gemfile.lock index 996958f..c941155 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - devise-api (0.1.2) + devise-api (0.1.3) devise (>= 4.7.2) dry-configurable (~> 1.0, >= 1.0.1) dry-initializer (>= 3.1.1) diff --git a/app/controllers/devise/api/tokens_controller.rb b/app/controllers/devise/api/tokens_controller.rb index 7417f19..beb8221 100644 --- a/app/controllers/devise/api/tokens_controller.rb +++ b/app/controllers/devise/api/tokens_controller.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# rubocop:disable Metrics/ClassLength module Devise module Api class TokensController < Devise.api.config.base_controller.constantize @@ -12,7 +13,7 @@ class TokensController < Devise.api.config.base_controller.constantize def sign_up unless Devise.api.config.sign_up.enabled error_response = Devise::Api::Responses::ErrorResponse.new(request, error: :sign_up_disabled, - resource_class: resource_class) + resource_class: resource_class) return render json: error_response.body, status: error_response.status end @@ -173,3 +174,4 @@ def current_devise_api_refresh_token end end end +# rubocop:enable Metrics/ClassLength diff --git a/lib/devise/api/version.rb b/lib/devise/api/version.rb index 38e9b7b..6fa02a1 100644 --- a/lib/devise/api/version.rb +++ b/lib/devise/api/version.rb @@ -2,6 +2,6 @@ module Devise module Api - VERSION = '0.1.2' + VERSION = '0.1.3' end end diff --git a/spec/devise/api/responses/error_response_spec.rb b/spec/devise/api/responses/error_response_spec.rb index 77c9060..0e07439 100644 --- a/spec/devise/api/responses/error_response_spec.rb +++ b/spec/devise/api/responses/error_response_spec.rb @@ -149,13 +149,13 @@ it 'has a body with an error and error description' do allow(I18n).to receive(:t) - .with('devise.api.error_response.sign_up_disabled') - .and_return('Sign up is disabled') + .with('devise.api.error_response.sign_up_disabled') + .and_return('Sign up is disabled') expect(error_response.body).to eq( - error: :sign_up_disabled, - error_description: ['Sign up is disabled'] - ) + error: :sign_up_disabled, + error_description: ['Sign up is disabled'] + ) expect(I18n).to have_received(:t).with('devise.api.error_response.sign_up_disabled') end diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index a78903a..aa65efa 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -417,7 +417,8 @@ allow(Devise.api.config.before_refresh).to receive(:call).and_call_original allow(Devise.api.config.after_successful_refresh).to receive(:call).and_call_original - post refresh_user_tokens_path, headers: authentication_headers_for(user, devise_api_token, :refresh_token), as: :json + post refresh_user_tokens_path, headers: authentication_headers_for(user, devise_api_token, :refresh_token), + as: :json end it 'returns http success' do