Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a pending spec for #245.

It's a bug in webmock (bblimke/webmock#246). This
spec will help prevent future regressions.

Closes #245.
  • Loading branch information...
commit ffaad77429327e4f0b45500e2ac43cef9a6f12a2 1 parent 271c564
Myron Marston myronmarston authored
22 spec/support/shared_example_groups/excon.rb
View
@@ -0,0 +1,22 @@
+shared_examples "Excon streaming" do
+ context "when Excon's streaming API is used" do
+ it 'properly records and plays back the response' do
+ VCR.stub(:real_http_connections_allowed? => true)
+ recorded, played_back = [1, 2].map do
+ chunks = []
+
+ VCR.use_cassette('excon_streaming', :record => :once) do
+ Excon.get "http://localhost:#{VCR::SinatraApp.port}/foo", :response_block => lambda { |chunk, remaining_bytes, total_bytes|
+ chunks << chunk
+ }
+ end
+
+ chunks.join
+ end
+
+ expect(recorded).to eq(played_back)
+ expect(recorded).to eq("FOO!")
+ end
+ end
+end
+
21 spec/vcr/library_hooks/excon_spec.rb
View
@@ -1,4 +1,5 @@
require 'spec_helper'
+require 'support/shared_example_groups/excon'
describe "Excon hook", :with_monkey_patches => :excon do
# TODO: figure out a way to get disabling VCR to work with Excon
@@ -63,25 +64,7 @@ def intercept_request(&interception)
end
end
- context "when Excon's streaming API is used" do
- it 'properly records and plays back the response' do
- VCR.stub(:real_http_connections_allowed? => true)
- recorded, played_back = [1, 2].map do
- chunks = []
-
- VCR.use_cassette('excon_streaming', :record => :once) do
- Excon.get "http://localhost:#{VCR::SinatraApp.port}/foo", :response_block => lambda { |chunk, remaining_bytes, total_bytes|
- chunks << chunk
- }
- end
-
- chunks.join
- end
-
- expect(recorded).to eq(played_back)
- expect(recorded).to eq("FOO!")
- end
- end
+ include_examples "Excon streaming"
context 'when Excon raises an error due to an unexpected response status' do
before(:each) do
8 spec/vcr/library_hooks/webmock_spec.rb
View
@@ -1,4 +1,5 @@
require 'spec_helper'
+require 'support/shared_example_groups/excon'
describe "WebMock hook", :with_monkey_patches => :webmock do
after(:each) do
@@ -111,4 +112,11 @@ def normalize_request_headers(headers)
end
end
end
+
+ it_behaves_like "Excon streaming" do
+ before(:each) do
+ pending "waiting on bblimke/webmock#246 for a fix"
+ end
+ end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.