diff --git a/spec/net_http_spec.rb b/spec/net_http_spec.rb index 74c018d06..faa66dcdd 100644 --- a/spec/net_http_spec.rb +++ b/spec/net_http_spec.rb @@ -57,7 +57,7 @@ req = Net::HTTP::Post.new("/") Net::HTTP.start("www.example.com") {|http| http.request(req, StringIO.new("my_params")) - }.body.should =~ /Example Web Page/ + }.body.should =~ /^$/ end it "should handle requests with block passed to read_body", :net_connect => true do @@ -71,7 +71,7 @@ end end end - body.should =~ /Example Web Page/ + body.should =~ /^$/ end it "should return a Net::ReadAdapter from response.body when a stubbed request is made with a block and #read_body" do @@ -128,7 +128,7 @@ end describe 'after_request callback support', :net_connect => true do - let(:expected_body_regex) { /You have reached this web page by typing.*example\.com/ } + let(:expected_body_regex) { /^$/ } before(:each) do WebMock.allow_net_connect! diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 053e39ead..eaaa02c30 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,8 +42,8 @@ def should_pass def setup_expectations_for_real_example_com_request(options = {}) defaults = { :host => "www.example.com", :port => 80, :method => "GET", :path => "/", - :response_code => 200, :response_message => "OK", - :response_body => "example" } + :response_code => 302, :response_message => "Found", + :response_body => "" } setup_expectations_for_real_request(defaults.merge(options)) end diff --git a/spec/webmock_shared.rb b/spec/webmock_shared.rb index 46cce4bdd..f41d8772d 100644 --- a/spec/webmock_shared.rb +++ b/spec/webmock_shared.rb @@ -4,7 +4,7 @@ SAMPLE_HEADERS = { "Content-Length" => "8888", "Accept" => "application/json" } ESCAPED_PARAMS = "x=ab%20c&z=%27Stop%21%27%20said%20Fred" NOT_ESCAPED_PARAMS = "z='Stop!' said Fred&x=ab c" - WWW_EXAMPLE_COM_CONTENT_LENGTH = 596 + WWW_EXAMPLE_COM_CONTENT_LENGTH = 0 end class MyException < StandardError; end; @@ -33,8 +33,7 @@ class MyException < StandardError; end; it "should make a real web request if request is not stubbed" do setup_expectations_for_real_example_com_request - http_request(:get, "http://www.example.com/"). - body.should =~ /.*example.*/ + http_request(:get, "http://www.example.com/").status.should == "302" end it "should make a real https request if request is not stubbed" do @@ -128,7 +127,7 @@ class MyException < StandardError; end; end it "should allow a real request to allowed host", :net_connect => true do - http_request(:get, "http://www.example.org/").status.should == "200" + http_request(:get, "http://www.example.org/").status.should == "302" end end end @@ -1493,8 +1492,8 @@ def call(request) end it "should pass response with status and message" do - @response.status[0].should == 200 - @response.status[1].should == "OK" + @response.status[0].should == 302 + @response.status[1].should == "Found" end it "should pass response with headers" do