Skip to content

Commit e6d6d1e

Browse files
committed
Resolve gradual RuboCop issues
1 parent ae40aeb commit e6d6d1e

10 files changed

Lines changed: 25 additions & 38 deletions

File tree

.rubocop_gradual.lock

Lines changed: 0 additions & 17 deletions
This file was deleted.

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
direnv 2.32.2
2-
ruby 3.4.3
2+
ruby 4.0.4

bin/bundle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ module_function
6060
Regexp.last_match(1)
6161
end
6262

63+
# rubocop:disable ThreadSafety/ClassInstanceVariable
6364
def bundler_requirement
6465
@bundler_requirement ||=
6566
env_var_version ||
6667
cli_arg_version ||
6768
bundler_requirement_for(lockfile_version)
6869
end
70+
# rubocop:enable ThreadSafety/ClassInstanceVariable
6971

7072
def bundler_requirement_for(version)
7173
return "#{Gem::Requirement.default}.a" unless version

snaky_hash.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
gem_version =
4-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1")
4+
if Gem.ruby_version >= Gem::Version.new("3.1")
55
# Loading Version into an anonymous module allows version.rb to get code coverage from SimpleCov!
66
# See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
77
Module.new.tap { |mod| Kernel.load("lib/snaky_hash/version.rb", mod) }::SnakyHash::Version::VERSION

spec/shared_contexts/base_hash.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#
55
# @example Using the shared context
66
# RSpec.describe MyClass do
7-
# include_context "base hash"
7+
# include_context "with a base hash"
88
# it "has data" do
99
# expect(base_hash["varOne"]).to eq(1)
1010
# end
1111
# end
12-
RSpec.shared_context "base hash" do
12+
RSpec.shared_context "with a base hash" do
1313
let(:base_hash) do
1414
bh = {
1515
"varOne" => 1,

spec/shared_examples/a_snaked_hash.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
hash_klass.new(base_hash)
2020
end
2121

22-
include_context "base hash"
22+
include_context "with a base hash"
2323

2424
it_behaves_like "a snaky hash instance"
2525
end
@@ -41,7 +41,7 @@
4141
hash_klass.new("apple" => "tart")
4242
end
4343

44-
include_context "base hash"
44+
include_context "with a base hash"
4545

4646
it_behaves_like "a snaky hash instance"
4747
end

spec/snaky_hash/bad_snake_spec.rb renamed to spec/snaky_hash/snake_bad_key_type_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
RSpec.describe "a bad one" do
3+
RSpec.describe SnakyHash::Snake do
44
subject(:bad_snake) do
55
Class.new(Hashie::Mash) do
66
include SnakyHash::Snake.new(key_type: :slartibartfarst)

spec/snaky_hash/snake_spec.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
# frozen_string_literal: true
22

33
RSpec.describe SnakyHash::Snake do
4-
class TheSnakedHash < Hashie::Mash
5-
include SnakyHash::Snake.new(key_type: :string)
4+
subject(:instance) do
5+
the_snaked_hash.new(base_hash)
66
end
77

8-
subject(:instance) do
9-
TheSnakedHash.new(base_hash)
8+
let(:the_snaked_hash) do
9+
Class.new(Hashie::Mash) do
10+
include described_class.new(key_type: :string)
11+
end
1012
end
1113

12-
include_context "base hash"
14+
include_context "with a base hash"
1315

1416
it_behaves_like "a snaky hash instance"
1517

1618
it "returns a SnakyHash::Snake from a snake + snake merge" do
17-
a = TheSnakedHash.new("asd" => "asd")
18-
b = TheSnakedHash.new(zxc: "zxc")
19-
expect(a.merge(b)).to be_a(TheSnakedHash)
19+
a = the_snaked_hash.new("asd" => "asd")
20+
b = the_snaked_hash.new(zxc: "zxc")
21+
expect(a.merge(b)).to be_a(the_snaked_hash)
2022
end
2123

2224
it "returns a SnakyHash::Snake from a snake + hash merge" do
23-
a = TheSnakedHash.new("asd" => "asd")
25+
a = the_snaked_hash.new("asd" => "asd")
2426
b = {zxc: "zxc"}
25-
expect(a.merge(b)).to be_a(TheSnakedHash)
27+
expect(a.merge(b)).to be_a(the_snaked_hash)
2628
end
2729

2830
it "returns a Hash from a hash + snake merge" do
29-
a = TheSnakedHash.new("asd" => "asd")
31+
a = the_snaked_hash.new("asd" => "asd")
3032
b = {zxc: "zxc"}
3133
res = b.merge(a)
32-
expect(res).not_to be_a(TheSnakedHash)
34+
expect(res).not_to be_a(the_snaked_hash)
3335
expect(res).to be_a(Hash)
3436
end
3537

spec/snaky_hash/string_keyed_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
described_class.new(base_hash)
66
end
77

8-
include_context "base hash"
8+
include_context "with a base hash"
99

1010
it_behaves_like "a snaky hash instance"
1111

spec/snaky_hash/symbol_keyed_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
described_class.new(base_hash)
66
end
77

8-
include_context "base hash"
8+
include_context "with a base hash"
99

1010
it_behaves_like "a snaky hash instance"
1111

0 commit comments

Comments
 (0)