Skip to content

Commit

Permalink
chore: upgrade rubocop config to v11
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraichen committed Aug 10, 2023
1 parent 9aefabf commit b5f82b3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
inherit_gem:
my-rubocop: default.yml
rubocop-config: default.yml

AllCops:
TargetRubyVersion: 2.5
SuggestExtensions: false
Exclude:
- vendor/**/*

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ gem 'rspec'
gem 'webmock', '~> 3.0'

group :test do
gem 'my-rubocop', github: 'jgraichen/my-rubocop'
gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v11', require: false
end
14 changes: 7 additions & 7 deletions lib/rack/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ def call(env)
else
[
200, {'Content-Type' => 'application/json'},
StringIO.new(MultiJson.dump(response))
StringIO.new(MultiJson.dump(response)),
]
end
rescue StandardError => e
[
500, {'Content-Type' => 'application/json'}, StringIO.new(
MultiJson.dump(
error: e.message, backtrace: e.backtrace, class: e.class.name
)
)
error: e.message, backtrace: e.backtrace, class: e.class.name,
),
),
]
end
else
Expand All @@ -86,9 +86,9 @@ def call(env)
MultiJson.dump(
error: 'remote call not defined',
calls: call,
list: self.class.calls.keys
)
)
list: self.class.calls.keys,
),
),
]
end
end
Expand Down
7 changes: 4 additions & 3 deletions rack-remote.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.name = 'rack-remote'
spec.version = Rack::Remote::VERSION
spec.authors = ['Jan Graichen']
spec.email = %w[jg@altimos.de]
spec.email = %w[jgraichen@altimos.de]
spec.summary = 'Small request intercepting rack middleware to ' \
'invoke remote calls over HTTP.'
spec.description = 'Small request intercepting rack middleware to ' \
Expand All @@ -19,11 +19,12 @@ Gem::Specification.new do |spec|

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

spec.add_dependency 'multi_json'
spec.add_dependency 'rack'

spec.add_development_dependency 'bundler'
spec.metadata['rubygems_mfa_required'] = 'true'

spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
end
12 changes: 10 additions & 2 deletions spec/rack/remote_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,22 @@
end

it 'invokes remote call' do
expect(block).to receive(:call).with({'param1' => 'val1'}, kind_of(Hash), kind_of(Rack::Request)).and_return({id: 1})
allow(block).to receive(:call)
.with({'param1' => 'val1'}, kind_of(Hash), kind_of(Rack::Request))
.and_return({id: 1})

ret = described_class.invoke :users, :factory_bot, param1: 'val1'

expect(ret).to eq({'id' => 1})
end

it 'invokes remote call (2)' do
expect(block).to receive(:call).with({'param1' => ['val1', {'abc' => 'cde'}]}, kind_of(Hash), kind_of(Rack::Request)).and_return({id: 1})
allow(block).to receive(:call)
.with({'param1' => ['val1', {'abc' => 'cde'}]}, kind_of(Hash), kind_of(Rack::Request))
.and_return({id: 1})

ret = described_class.invoke :users, :factory_bot, param1: ['val1', {abc: :cde}]

expect(ret).to eq({'id' => 1})
end
end
Expand Down

0 comments on commit b5f82b3

Please sign in to comment.