1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Fix RuboCop offenses introduced in version 0.22.0

This commit is contained in:
tmilewski 2014-05-30 14:42:00 -04:00
parent 60f2c9d545
commit edc97c636a
6 changed files with 20 additions and 15 deletions

View file

@ -1,5 +1,5 @@
AllCops:
Includes:
Include:
- 'Gemfile'
- 'Rakefile'
- 'omniauth.gemspec'
@ -11,7 +11,7 @@ ParameterLists:
MethodLength:
CountComments: false
Max: 14
Max: 15
# Avoid more than `Max` levels of nesting.
BlockNesting:
@ -76,3 +76,6 @@ RaiseArgs:
TrailingComma:
Enabled: false
EachWithObject:
Enabled: false

View file

@ -87,11 +87,13 @@ module OmniAuth
mock.keys.each do |key|
mock[key.to_s] = mock.delete(key)
end
mock.each_pair do |key, val|
mock.each_pair do |_key, val|
if val.is_a? Hash
val.keys.each do |subkey|
val[subkey.to_s] = val.delete(subkey)
end
else
next
end
end
@ -113,7 +115,7 @@ module OmniAuth
camelizations[name.to_s] = camelized.to_s
end
attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase
attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase
attr_accessor :failure_raise_out_environments, :path_prefix, :allowed_request_methods, :form_css, :test_mode, :mock_auth, :full_host, :camelizations, :logger
end

View file

@ -126,7 +126,7 @@ module OmniAuth
# will be passed through and set to the appropriate values.
#
# @yield [Options] Yields options to block for further configuration.
def initialize(app, *args, &block)
def initialize(app, *args, &block) # rubocop:disable UnusedMethodArgument
@app = app
@env = nil
@options = self.class.default_options.dup
@ -256,7 +256,7 @@ module OmniAuth
# This is called in lieu of the normal request process
# in the event that OmniAuth has been configured to be
# in test mode.
def mock_call!(env)
def mock_call!(*)
return mock_request_call if on_request_path?
return mock_callback_call if on_callback_path?
call_app!

View file

@ -19,7 +19,7 @@ OmniAuth.config.logger = Logger.new('/dev/null')
RSpec.configure do |config|
config.include Rack::Test::Methods
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
config.expect_with :rspec do |c|
c.syntax = :expect
end

View file

@ -5,7 +5,7 @@ describe OmniAuth::Strategies::Developer do
Rack::Builder.new do |b|
b.use Rack::Session::Cookie, :secret => 'abc123'
b.use OmniAuth::Strategies::Developer
b.run lambda { |env| [200, {}, ['Not Found']] }
b.run lambda { |_env| [200, {}, ['Not Found']] }
end.to_app
end
@ -52,7 +52,7 @@ describe OmniAuth::Strategies::Developer do
Rack::Builder.new do |b|
b.use Rack::Session::Cookie, :secret => 'abc123'
b.use OmniAuth::Strategies::Developer, :fields => [:first_name, :last_name], :uid_field => :last_name
b.run lambda { |env| [200, {}, ['Not Found']] }
b.run lambda { |_env| [200, {}, ['Not Found']] }
end.to_app
end

View file

@ -11,7 +11,7 @@ end
describe OmniAuth::Strategy do
let(:app) do
lambda { |env| [404, {}, ['Awesome']] }
lambda { |_env| [404, {}, ['Awesome']] }
end
let(:fresh_strategy) do
@ -397,7 +397,7 @@ describe OmniAuth::Strategy do
context ':form option' do
it 'calls through to the supplied form option if one exists' do
strategy.options.form = lambda { |env| 'Called me!' }
strategy.options.form = lambda { |_env| 'Called me!' }
expect(strategy.call(make_env('/auth/test'))).to eq('Called me!')
end
@ -409,17 +409,17 @@ describe OmniAuth::Strategy do
context 'dynamic paths' do
it 'runs the request phase if the custom request path evaluator is truthy' do
@options = {:request_path => lambda { |env| true }}
@options = {:request_path => lambda { |_env| true }}
expect { strategy.call(make_env('/asoufibasfi')) }.to raise_error('Request Phase')
end
it 'runs the callback phase if the custom callback path evaluator is truthy' do
@options = {:callback_path => lambda { |env| true }}
@options = {:callback_path => lambda { |_env| true }}
expect { strategy.call(make_env('/asoufiasod')) }.to raise_error('Callback Phase')
end
it 'provides a custom callback path if request_path evals to a string' do
strategy_instance = fresh_strategy.new(nil, :request_path => lambda { |env| '/auth/boo/callback/22' })
strategy_instance = fresh_strategy.new(nil, :request_path => lambda { |_env| '/auth/boo/callback/22' })
expect(strategy_instance.callback_path).to eq('/auth/boo/callback/22')
end
@ -549,7 +549,7 @@ describe OmniAuth::Strategy do
context 'test mode' do
let(:app) do
# In test mode, the underlying app shouldn't be called on request phase.
lambda { |env| [404, {'Content-Type' => 'text/html'}, []] }
lambda { |_env| [404, {'Content-Type' => 'text/html'}, []] }
end
before do