Skip to content

Commit

Permalink
Correct some RuboCop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Aug 2, 2024
1 parent 83fbd49 commit a26782a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Reduce some files from gem package.
- Correct some RuboCop offenses.

## 0.5.0 - 2024-03-28

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in rspec-request_describer.gemspec
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
4 changes: 3 additions & 1 deletion lib/rspec/request_describer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rspec/request_describer/version'

module RSpec
Expand Down Expand Up @@ -56,7 +58,7 @@ def included(base)
let(:env) do
headers.inject({}) do |result, (key, value)|
key = key.to_s
key = 'HTTP_' + key unless RESERVED_HEADER_NAMES.include?(key.downcase)
key = "HTTP_#{key}" unless RESERVED_HEADER_NAMES.include?(key.downcase)
key = key.tr('-', '_').upcase
result.merge(key => value)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/rspec/request_describer/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

module RSpec
module RequestDescriber
VERSION = '0.5.0'.freeze
VERSION = '0.5.0'
end
end
2 changes: 2 additions & 0 deletions rspec-request_describer.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Check warning on line 1 in rspec-request_describer.gemspec

View workflow job for this annotation

GitHub Actions / rubocop / rubocop

Gemspec/RequiredRubyVersion: required_ruby_version should be specified.

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rspec/request_describer/version'
Expand Down
34 changes: 18 additions & 16 deletions spec/rspec/request_describer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'openssl'

RSpec.describe RSpec::RequestDescriber do
Expand All @@ -13,8 +15,8 @@ def get(*args)
[
:get,
'/users',
headers: {},
params: {}
{ headers: {},
params: {} }
]
)
end
Expand All @@ -29,8 +31,8 @@ def get(*args)
[
:get,
'/users',
headers: { 'HTTP_AUTHORIZATION' => 'token 12345' },
params: {}
{ headers: { 'HTTP_AUTHORIZATION' => 'token 12345' },
params: {} }
]
)
end
Expand All @@ -46,8 +48,8 @@ def get(*args)
[
:get,
'/users',
headers: { 'HTTPS' => 'on' },
params: {}
{ headers: { 'HTTPS' => 'on' },
params: {} }
]
)
end
Expand All @@ -63,8 +65,8 @@ def get(*args)
[
:get,
'/users',
headers: { 'HTTP_AUTHORIZATION' => 'token 12345' },
params: {}
{ headers: { 'HTTP_AUTHORIZATION' => 'token 12345' },
params: {} }
]
)
end
Expand All @@ -80,8 +82,8 @@ def get(*args)
[
:get,
'/users',
headers: { 'HTTP_X_SIGNATURE' => 'sha1=5d61605c3feea9799210ddcb71307d4ba264225f' },
params: {}
{ headers: { 'HTTP_X_SIGNATURE' => 'sha1=5d61605c3feea9799210ddcb71307d4ba264225f' },
params: {} }
]
)
end
Expand All @@ -97,8 +99,8 @@ def get(*args)
[
:get,
'/users',
headers: {},
params: { 'sort' => 'id' }
{ headers: {},
params: { 'sort' => 'id' } }
]
)
end
Expand All @@ -114,8 +116,8 @@ def get(*args)
[
:get,
'/users',
headers: {},
params: { 'sort' => 'id' }
{ headers: {},
params: { 'sort' => 'id' } }
]
)
end
Expand All @@ -132,8 +134,8 @@ def get(*args)
[
:get,
'/users/1',
headers: {},
params: {}
{ headers: {},
params: {} }
]
)
end
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rspec/request_describer'

RSpec.configure do |config|
Expand Down

0 comments on commit a26782a

Please sign in to comment.