Skip to content

Commit

Permalink
Add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mspangler committed Aug 8, 2022
1 parent edfb253 commit c6e0537
Showing 1 changed file with 6 additions and 0 deletions.
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 c6e0537

Please sign in to comment.