Skip to content

Commit

Permalink
Merge pull request #994 from mspangler/master
Browse files Browse the repository at this point in the history
Fix Syntax Error: `reutrn`
  • Loading branch information
bblimke authored Aug 9, 2022
2 parents c7a2d1e + c6e0537 commit 5bdd4ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webmock/request_pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def matching_body_array?(query_parameters, pattern, content_type)

query_parameters.each_with_index do |actual, index|
expected = pattern[index]
reutrn false unless matching_values(actual, expected, content_type)
return false unless matching_values(actual, expected, content_type)
end

true
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/request_pattern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@ def match(request_signature)
headers: {content_type: content_type}, body: "[{\"a\":1}]"))
end

it "should not match if the request body has a different top level array" do
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: ["a", "b"])).
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
headers: {content_type: content_type}, body: "[\"a\", \"c\"]"))
end

it "should not match when body is not json" do
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
Expand Down

0 comments on commit 5bdd4ac

Please sign in to comment.