Skip to content

Commit

Permalink
Merge pull request #1092 from Juanmcuello/ruby-3.4-fix-hash-specs
Browse files Browse the repository at this point in the history
fix: make specs pass with ruby 3.4
  • Loading branch information
koic authored Feb 6, 2025
2 parents 2b963cb + cccfedd commit 07eeb75
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
matrix:
ruby:
- head
- '3.4'
- '3.3'
- '3.2'
- '3.1'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/matchers/hash_excluding_matcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Matchers
end

it 'describes itself properly' do
expect(HashExcludingMatcher.new(a: 1).inspect).to eq 'hash_excluding({"a"=>1})'
expect(HashExcludingMatcher.new(a: 1).inspect).to eq "hash_excluding(#{{'a' => 1}})"
end

describe 'success' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/matchers/hash_including_matcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Matchers
end

it "describes itself properly" do
expect(HashIncludingMatcher.new(a: 1).inspect).to eq "hash_including({\"a\"=>1})"
expect(HashIncludingMatcher.new(a: 1).inspect).to eq "hash_including(#{{"a" => 1}})"
end

describe "success" do
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/request_pattern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@

it "should report string describing itself with query params" do
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {'a' => ['b', 'c']}).to_s).to eq(
"GET /.*example.*/ with query params {\"a\"=>[\"b\", \"c\"]}"
"GET /.*example.*/ with query params #{{"a" => ["b", "c"]}}"
)
end

it "should report string describing itself with query params as hash including matcher" do
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
query: WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s).to eq(
"GET /.*example.*/ with query params hash_including({\"a\"=>[\"b\", \"c\"]})"
"GET /.*example.*/ with query params hash_including(#{{"a" => ["b", "c"]}})"
)
end

it "should report string describing itself with body as hash including matcher" do
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
body: WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s).to eq(
"GET /.*example.*/ with body hash_including({\"a\"=>[\"b\", \"c\"]})"
"GET /.*example.*/ with body hash_including(#{{"a" => ["b", "c"]}})"
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/request_signature_snippet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
result = subject.request_stubs
result.sub!("registered request stubs:\n\n", "")
expect(result).to eq(
"stub_request(:get, \"https://www.example.com/\").\n with(\n body: {\"a\"=>\"b\"})"
"stub_request(:get, \"https://www.example.com/\").\n with(\n body: #{{"a" => "b"}})"
)
end

Expand All @@ -74,7 +74,7 @@
result = subject.request_stubs
result.sub!("registered request stubs:\n\n", "")
expect(result).to eq(
"stub_request(:get, \"https://www.example.com/\").\n with(\n body: {\"a\"=>\"b\"})\n\nBody diff:\n [[\"-\", \"key\", \"different value\"], [\"+\", \"a\", \"b\"]]\n"
"stub_request(:get, \"https://www.example.com/\").\n with(\n body: #{{"a" => "b"}})\n\nBody diff:\n [[\"-\", \"key\", \"different value\"], [\"+\", \"a\", \"b\"]]\n"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/stub_request_snippet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
expected = <<-STUB
stub_request(:post, "http://www.example.com/").
with(
body: {"user"=>{"first_name"=>"Bartosz"}},
body: #{{"user" => {"first_name" => "Bartosz"}}},
headers: {
\t 'Content-Type'=>'application/x-www-form-urlencoded'
}).
Expand Down

0 comments on commit 07eeb75

Please # to comment.