Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions spec/webmock_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ describe WebMock do
end
end

it "uses the most recently called stub of the same url" do
WebMock.wrap do
WebMock.stub(:get, "www.example.com").to_return(body: "unu")
WebMock.stub(:get, "www.example.com").to_return(body: "du")

HTTP::Client.get("http://www.example.com").body.should eq("du")
end
end

it "stubs indefinitely" do
WebMock.wrap do
WebMock.stub(:get, "www.example.com").to_return(body: "unu")
Expand Down
2 changes: 1 addition & 1 deletion src/webmock/stub_registry.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct WebMock::StubRegistry

def stub(method, uri)
stub = Stub.new(method, uri)
@stubs << stub
@stubs.unshift(stub)
stub
end

Expand Down