spec/unit/request_pattern_spec.rb in webmock-1.20.2 vs spec/unit/request_pattern_spec.rb in webmock-1.20.3
- old
+ new
@@ -46,9 +46,16 @@
it "should have assigned normalized headers pattern" do
@request_pattern.with(:headers => {'A' => 'a'})
@request_pattern.to_s.should ==WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
end
+ it "should raise an error if options passed to `with` are invalid" do
+ expect { @request_pattern.with(:foo => "bar") }.to raise_error('Unknown key: "foo". Valid keys are: "body", "headers", "query"')
+ end
+
+ it "should raise an error if neither options or block is provided" do
+ expect { @request_pattern.with() }.to raise_error('#with method invoked with no arguments. Either options hash or block must be specified.')
+ end
end
class WebMock::RequestPattern
def match(request_signature)