Skip to content

Commit

Permalink
Add negative match assertion spec
Browse files Browse the repository at this point in the history
  • Loading branch information
valscion committed Mar 9, 2020
1 parent 16d6386 commit 70f4a24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/unit/request_pattern_spec.rb
Expand Up @@ -138,6 +138,12 @@ def match(request_signature)
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
end

it "should not match if Addressable::Template pattern host does not match request uri" do
signature = WebMock::RequestSignature.new(:get, "www.bad-example.com")
uri = Addressable::Template.new("{subdomain}.example.com")
expect(WebMock::RequestPattern.new(:get, uri)).not_to match(signature)
end

it "should match for uris with same parameters as pattern" do
expect(WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2")).
to match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
Expand Down

0 comments on commit 70f4a24

Please sign in to comment.