-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
adapter = Isolator.isolate :vcr, | ||
exception_class: Isolator::HTTPError, | ||
details_message: ->(request) { | ||
"#{request.method.to_s.upcase} #{request.uri}" | ||
} | ||
|
||
VCR.configure do |c| | ||
c.after_http_request do |request, _response| | ||
# check if we are even notifying before calling `caller`, which is well known to be slow | ||
adapter.notify(caller, request) if adapter.notify?(request) | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "VCR adapter" do | ||
let(:uri) { URI.parse("http://localhost:4567/?lang=ruby&author=matz") } | ||
|
||
before do | ||
allow(Isolator).to receive(:within_transaction?) { true } | ||
end | ||
|
||
describe "#get" do | ||
specify do | ||
VCR.use_cassette "example" do | ||
expect { Net::HTTP.get(uri) }.to raise_error(Isolator::HTTPError, %r{GET http://localhost:4567/\?author=matz&lang=ruby}) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
VCR.configure do |config| | ||
config.cassette_library_dir = "spec/integrations/fixtures/vcr_cassettes" | ||
config.hook_into :webmock | ||
config.allow_http_connections_when_no_cassette = false | ||
end |