Skip to content

Commit

Permalink
Rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Bollinger committed Apr 25, 2015
1 parent 319c71c commit 4dabf57
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions lib/pester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Pester
def self.configure(&block)
Config.configure(&block)
unless Config.environments.nil?
self.environments = Hash[Config.environments.select { |_, e| e.is_a?(Hash)}.map { |k, e| [k.to_sym, Environment.new(e)] }]
self.environments = Hash[Config.environments.select { |_, e| e.is_a?(Hash) }.map { |k, e| [k.to_sym, Environment.new(e)] }]
end
end

Expand Down Expand Up @@ -80,12 +80,14 @@ def self.retry_action(opts = {}, &block)
end

def respond_to?(method_sym)
super || Config.environments.has_key?(method_sym)
super || Config.environments.key?(method_sym)
end

def method_missing(method_sym)
if Config.environments.has_key?(method_sym)
if Config.environments.key?(method_sym)
Config.environments[method_sym]
else
super
end
end

Expand Down
4 changes: 2 additions & 2 deletions pester.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ EOD
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_development_dependency 'bundler', '~> 1.6'
Expand Down
12 changes: 6 additions & 6 deletions spec/environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
describe 'Delegation to Pester' do
context 'for retry-prefixed methods' do
context 'which are supported' do
let(:pester) { class_double("Pester").as_stubbed_const }
let(:pester) { class_double('Pester').as_stubbed_const }

context 'without options' do
it 'calls Pester#retry without options' do
expect(pester).to receive(:send).with(:retry, {})
environment.retry { }
environment.retry {}
end
end
context 'with options' do
let(:options) { { test_opt: 1234 } }

it 'calls Pester#retry with the given options' do
expect(pester).to receive(:send).with(:retry, options)
environment.retry { }
environment.retry {}
end
end
end
Expand All @@ -29,16 +29,16 @@
let(:options) { { test_opt: 1234 } }

it 'lets Pester raise NoMethodError' do
expect { environment.retry_does_not_exist { } }.to raise_error(NoMethodError)
expect { environment.retry_does_not_exist {} }.to raise_error(NoMethodError)
end
end
end

context 'for non-retry-prefixed methods' do
let(:pester) { class_double("Pester").as_stubbed_const }
let(:pester) { class_double('Pester').as_stubbed_const }

it 'raises NoMethodError' do
expect { environment.something_else { } }.to raise_error(NoMethodError)
expect { environment.something_else {} }.to raise_error(NoMethodError)
end
end
end
Expand Down

0 comments on commit 4dabf57

Please sign in to comment.