Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize @pattern as symbol in MethodPattern #886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/webmock/request_pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def create_uri_pattern(uri)

class MethodPattern
def initialize(pattern)
@pattern = pattern
@pattern = pattern.to_sym
end

def matches?(method)
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/request_pattern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def match(request_signature)
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
end

it "should match if method is described as string" do
expect(WebMock::RequestPattern.new("any", "www.example.com")).
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
end

it "should match if request has unescaped uri" do
expect(WebMock::RequestPattern.new(:get, "www.example.com/my%20path")).
to match(WebMock::RequestSignature.new(:get, "www.example.com/my path"))
Expand Down