From 1a22b7392f86322d413ea074ffb87df51a69089d Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Sat, 10 Sep 2011 16:52:03 -0700 Subject: [PATCH] Don't bother testing against 1.9.1 anymore. I don't plan to have VCR 2.0 support 1.9.1 and this allows us to cleanup a lot of special case code for 1.9.1. --- Gemfile | 3 - features/step_definitions/cli_steps.rb | 26 +-- script/FullBuildRakeFile | 7 - script/full_build | 2 +- .../{not_1.9.1 => }/0_3_1_cassette.yml | 0 spec/fixtures/1.9.1/0_3_1_cassette.yml | 29 --- spec/fixtures/1.9.1/cassette_spec/example.yml | 110 ----------- .../cassette_spec/with_localhost_requests.yml | 109 ----------- .../1.9.1/fake_example.com_responses.yml | 108 ---------- spec/fixtures/1.9.1/match_requests_on.yml | 185 ------------------ .../{1.9.1 => }/cassette_spec/empty.yml | 0 .../{not_1.9.1 => }/cassette_spec/example.yml | 0 .../cassette_spec/with_localhost_requests.yml | 0 .../fixtures/{1.9.1 => }/example_net_http.yml | 0 .../{1.9.1 => }/example_net_http_request.yml | 0 .../{1.9.1 => }/example_net_http_response.yml | 0 .../fake_example.com_responses.yml | 0 .../{not_1.9.1 => }/match_requests_on.yml | 0 .../not_1.9.1/cassette_spec/empty.yml | 0 spec/fixtures/not_1.9.1/example_net_http.yml | 14 -- .../not_1.9.1/example_net_http_request.yml | 12 -- .../not_1.9.1/example_net_http_response.yml | 25 --- spec/spec_helper.rb | 5 +- .../shared_example_groups/http_library.rb | 4 +- .../http_stubbing_adapter.rb | 2 +- spec/vcr/cassette_spec.rb | 26 +-- spec/vcr/structs/request_spec.rb | 4 +- spec/vcr/structs/response_spec.rb | 2 +- spec/vcr/structs/response_status_spec.rb | 2 +- 29 files changed, 23 insertions(+), 652 deletions(-) rename spec/fixtures/{not_1.9.1 => }/0_3_1_cassette.yml (100%) delete mode 100644 spec/fixtures/1.9.1/0_3_1_cassette.yml delete mode 100644 spec/fixtures/1.9.1/cassette_spec/example.yml delete mode 100644 spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml delete mode 100644 spec/fixtures/1.9.1/fake_example.com_responses.yml delete mode 100644 spec/fixtures/1.9.1/match_requests_on.yml rename spec/fixtures/{1.9.1 => }/cassette_spec/empty.yml (100%) rename spec/fixtures/{not_1.9.1 => }/cassette_spec/example.yml (100%) rename spec/fixtures/{not_1.9.1 => }/cassette_spec/with_localhost_requests.yml (100%) rename spec/fixtures/{1.9.1 => }/example_net_http.yml (100%) rename spec/fixtures/{1.9.1 => }/example_net_http_request.yml (100%) rename spec/fixtures/{1.9.1 => }/example_net_http_response.yml (100%) rename spec/fixtures/{not_1.9.1 => }/fake_example.com_responses.yml (100%) rename spec/fixtures/{not_1.9.1 => }/match_requests_on.yml (100%) delete mode 100644 spec/fixtures/not_1.9.1/cassette_spec/empty.yml delete mode 100644 spec/fixtures/not_1.9.1/example_net_http.yml delete mode 100644 spec/fixtures/not_1.9.1/example_net_http_request.yml delete mode 100644 spec/fixtures/not_1.9.1/example_net_http_response.yml diff --git a/Gemfile b/Gemfile index a5090140..6ee42f7b 100644 --- a/Gemfile +++ b/Gemfile @@ -31,13 +31,10 @@ group :extras do platforms :mri_18 do gem 'ruby-debug' - gem 'linecache', '0.43' # later versions do not work on 1.8.6 end platforms :mri_19 do - gem 'linecache19', '0.5.11' # 0.5.12 cannot install on 1.9.1, and 0.5.11 appears to work with both 1.9.1 & 1.9.2 gem 'ruby-debug19' - gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24' end unless RUBY_VERSION == '1.9.3' end diff --git a/features/step_definitions/cli_steps.rb b/features/step_definitions/cli_steps.rb index 8cf10233..c7ca736e 100644 --- a/features/step_definitions/cli_steps.rb +++ b/features/step_definitions/cli_steps.rb @@ -1,32 +1,8 @@ require 'vcr' module VCRHelpers - YAML_REGEX_FOR_1_9_1 = Regexp.union(*[ - ' request', - ' method', - ' uri', - ' body', - ' headers', - ' response', - ' status', - ' code', - ' message', - ' body', - ' http_version' - ].uniq) - - def normalize_cassette_yaml(content) - return content unless RUBY_VERSION == '1.9.1' - - # Ruby 1.9.1 serializes YAML a bit different, so - # we deal with that difference and add leading colons here. - content = content.gsub(YAML_REGEX_FOR_1_9_1) do |match| - match.sub(/^ +/, '\0:') - end - end def normalize_cassette_structs(content) - content = normalize_cassette_yaml(content) structs = YAML.load(content) # Remove non-deterministic headers @@ -69,7 +45,7 @@ def modify_file(file_name, orig_text, new_text) end Given /^a previously recorded cassette file "([^"]*)" with:$/ do |file_name, content| - write_file(file_name, normalize_cassette_yaml(content)) + write_file(file_name, content) end Given /^(\d+) days have passed since the cassette was recorded$/ do |day_count| diff --git a/script/FullBuildRakeFile b/script/FullBuildRakeFile index a20cd62f..d441fb16 100644 --- a/script/FullBuildRakeFile +++ b/script/FullBuildRakeFile @@ -37,13 +37,6 @@ task :print_ruby_description do end task :bundle_install => :ensure_bundler_installed do - # Unfortunately, there is no version of ruby-debug that installs cleanly on 1.9.1 and 1.9.2. - # Our Gemfile specifies different versions using conditionals, but we still need to bundle update - # to get bundler to use the different versions. - if RUBY_VERSION =~ /^1\.9/ - sh "bundle update ruby-debug-base19" - end - sh "bundle install" end diff --git a/script/full_build b/script/full_build index 19b60be0..1ab3ef10 100755 --- a/script/full_build +++ b/script/full_build @@ -1 +1 @@ -rvm 1.8.6,1.8.7,1.9.1,1.9.2,ree,rbx rake -f script/FullBuildRakeFile build | tee tmp/full_build.out +rvm 1.8.7,1.9.2,ree,rbx rake -f script/FullBuildRakeFile build | tee tmp/full_build.out diff --git a/spec/fixtures/not_1.9.1/0_3_1_cassette.yml b/spec/fixtures/0_3_1_cassette.yml similarity index 100% rename from spec/fixtures/not_1.9.1/0_3_1_cassette.yml rename to spec/fixtures/0_3_1_cassette.yml diff --git a/spec/fixtures/1.9.1/0_3_1_cassette.yml b/spec/fixtures/1.9.1/0_3_1_cassette.yml deleted file mode 100644 index eba29bda..00000000 --- a/spec/fixtures/1.9.1/0_3_1_cassette.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- !ruby/struct:VCR::RecordedResponse - :method: :post - :uri: http://example.com:80/ - :response: !ruby/object:Net::HTTPOK - body: The response from example.com - body_exist: true - code: "200" - header: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - content-type: - - text/html; charset=UTF-8 - connection: - - close - server: - - Apache/2.2.3 (CentOS) - date: - - Wed, 31 Mar 2010 02:43:26 GMT - content-length: - - "438" - accept-ranges: - - bytes - http_version: "1.1" - message: OK - read: true - socket: diff --git a/spec/fixtures/1.9.1/cassette_spec/example.yml b/spec/fixtures/1.9.1/cassette_spec/example.yml deleted file mode 100644 index 6043f2bf..00000000 --- a/spec/fixtures/1.9.1/cassette_spec/example.yml +++ /dev/null @@ -1,110 +0,0 @@ ---- -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - server: - - Apache/2.2.3 (Red Hat) - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - etag: - - "\"b300b4-1b6-4059a80bfd280\"" - accept-ranges: - - bytes - content-type: - - text/html; charset=UTF-8 - connection: - - Keep-Alive - date: - - Mon, 25 Jan 2010 18:00:32 GMT - age: - - "2090" - content-length: - - "438" - :body: | - - - Example Web Page - - -

You have reached this web page by typing "example.com", - "example.net", - or "example.org" into your web browser.

-

These domain names are reserved for use in documentation and are not available - for registration. See RFC - 2606, Section 3.

- - - - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/foo - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 404 - :message: Not Found - :headers: - date: - - Mon, 25 Jan 2010 18:00:32 GMT - server: - - Apache/2.2.3 (CentOS) - content-length: - - "277" - connection: - - close - content-type: - - text/html; charset=iso-8859-1 - :body: | - - - 404 Not Found - -

Not Found

-

The requested URL /foo was not found on this server.

-
-
Apache/2.2.3 (CentOS) Server at example.com Port 80
- - - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - server: - - Apache/2.2.3 (Red Hat) - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - etag: - - "\"b300b4-1b6-4059a80bfd280\"" - accept-ranges: - - bytes - content-type: - - text/html; charset=UTF-8 - connection: - - Keep-Alive - date: - - Mon, 25 Jan 2010 18:00:32 GMT - age: - - "2090" - content-length: - - "438" - :body: Another example.com response - :http_version: "1.1" diff --git a/spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml b/spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml deleted file mode 100644 index 2219bf16..00000000 --- a/spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml +++ /dev/null @@ -1,109 +0,0 @@ ---- -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://localhost:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - connection: - - Keep-Alive - content-type: - - text/html; charset=UTF-8 - date: - - Thu, 25 Feb 2010 07:53:51 GMT - server: - - Apache/2.2.3 (CentOS) - content-length: - - "438" - age: - - "9260" - accept-ranges: - - bytes - :body: Localhost response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://127.0.0.1:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 404 - :message: Not Found - :headers: - content-type: - - text/html; charset=iso-8859-1 - connection: - - close - server: - - Apache/2.2.3 (CentOS) - date: - - Thu, 25 Feb 2010 07:53:52 GMT - content-length: - - "277" - :body: 127.0.0.1 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://0.0.0.0:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 404 - :message: Not Found - :headers: - content-type: - - text/html; charset=iso-8859-1 - connection: - - close - server: - - Apache/2.2.3 (CentOS) - date: - - Thu, 25 Feb 2010 07:53:52 GMT - content-length: - - "277" - :body: 127.0.0.1 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - connection: - - Keep-Alive - content-type: - - text/html; charset=UTF-8 - date: - - Thu, 25 Feb 2010 07:53:51 GMT - server: - - Apache/2.2.3 (CentOS) - content-length: - - "438" - age: - - "9260" - accept-ranges: - - bytes - :body: example.com response - :http_version: "1.1" diff --git a/spec/fixtures/1.9.1/fake_example.com_responses.yml b/spec/fixtures/1.9.1/fake_example.com_responses.yml deleted file mode 100644 index aff9b998..00000000 --- a/spec/fixtures/1.9.1/fake_example.com_responses.yml +++ /dev/null @@ -1,108 +0,0 @@ ---- -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/foo - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - connection: - - Keep-Alive - content-type: - - text/html; charset=UTF-8 - date: - - Wed, 31 Mar 2010 02:43:23 GMT - server: - - Apache/2.2.3 (CentOS) - content-length: - - "438" - age: - - "3285" - accept-ranges: - - bytes - :body: example.com get response 1 with path=foo - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/foo - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - connection: - - Keep-Alive - content-type: - - text/html; charset=UTF-8 - date: - - Wed, 31 Mar 2010 02:43:23 GMT - server: - - Apache/2.2.3 (CentOS) - content-length: - - "438" - age: - - "3285" - accept-ranges: - - bytes - :body: example.com get response 2 with path=foo - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/ - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - content-type: - - text/html; charset=UTF-8 - connection: - - close - server: - - Apache/2.2.3 (CentOS) - date: - - Wed, 31 Mar 2010 02:43:26 GMT - content-length: - - "438" - accept-ranges: - - bytes - :body: example.com post response with id=3 - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/two_set_cookie_headers - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - set-cookie: - - bar=bazz - - foo=bar - :body: this response has two set-cookie headers - :http_version: "1.1" diff --git a/spec/fixtures/1.9.1/match_requests_on.yml b/spec/fixtures/1.9.1/match_requests_on.yml deleted file mode 100644 index f3e5afdf..00000000 --- a/spec/fixtures/1.9.1/match_requests_on.yml +++ /dev/null @@ -1,185 +0,0 @@ ---- -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/method - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: post method response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :get - :uri: http://example.com:80/method - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: get method response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example1.com:80/host - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: example1.com host response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example2.com:80/host - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: example2.com host response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/path1 - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: path1 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/path2 - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: path2 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/uri1 - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: uri1 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/uri2 - :body: - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: uri2 response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/ - :body: param=val1 - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: val1 body response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/ - :body: param=val2 - :headers: - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: val2 body response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/ - :body: - :headers: - x-http-header1: - - val1 - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: val1 header response - :http_version: "1.1" -- !ruby/struct:VCR::HTTPInteraction - :request: !ruby/struct:VCR::Request - :method: :post - :uri: http://example.com:80/ - :body: - :headers: - x-http-header1: - - val2 - :response: !ruby/struct:VCR::Response - :status: !ruby/struct:VCR::ResponseStatus - :code: 200 - :message: OK - :headers: - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - :body: val2 header response - :http_version: "1.1" diff --git a/spec/fixtures/1.9.1/cassette_spec/empty.yml b/spec/fixtures/cassette_spec/empty.yml similarity index 100% rename from spec/fixtures/1.9.1/cassette_spec/empty.yml rename to spec/fixtures/cassette_spec/empty.yml diff --git a/spec/fixtures/not_1.9.1/cassette_spec/example.yml b/spec/fixtures/cassette_spec/example.yml similarity index 100% rename from spec/fixtures/not_1.9.1/cassette_spec/example.yml rename to spec/fixtures/cassette_spec/example.yml diff --git a/spec/fixtures/not_1.9.1/cassette_spec/with_localhost_requests.yml b/spec/fixtures/cassette_spec/with_localhost_requests.yml similarity index 100% rename from spec/fixtures/not_1.9.1/cassette_spec/with_localhost_requests.yml rename to spec/fixtures/cassette_spec/with_localhost_requests.yml diff --git a/spec/fixtures/1.9.1/example_net_http.yml b/spec/fixtures/example_net_http.yml similarity index 100% rename from spec/fixtures/1.9.1/example_net_http.yml rename to spec/fixtures/example_net_http.yml diff --git a/spec/fixtures/1.9.1/example_net_http_request.yml b/spec/fixtures/example_net_http_request.yml similarity index 100% rename from spec/fixtures/1.9.1/example_net_http_request.yml rename to spec/fixtures/example_net_http_request.yml diff --git a/spec/fixtures/1.9.1/example_net_http_response.yml b/spec/fixtures/example_net_http_response.yml similarity index 100% rename from spec/fixtures/1.9.1/example_net_http_response.yml rename to spec/fixtures/example_net_http_response.yml diff --git a/spec/fixtures/not_1.9.1/fake_example.com_responses.yml b/spec/fixtures/fake_example.com_responses.yml similarity index 100% rename from spec/fixtures/not_1.9.1/fake_example.com_responses.yml rename to spec/fixtures/fake_example.com_responses.yml diff --git a/spec/fixtures/not_1.9.1/match_requests_on.yml b/spec/fixtures/match_requests_on.yml similarity index 100% rename from spec/fixtures/not_1.9.1/match_requests_on.yml rename to spec/fixtures/match_requests_on.yml diff --git a/spec/fixtures/not_1.9.1/cassette_spec/empty.yml b/spec/fixtures/not_1.9.1/cassette_spec/empty.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/fixtures/not_1.9.1/example_net_http.yml b/spec/fixtures/not_1.9.1/example_net_http.yml deleted file mode 100644 index cce258fd..00000000 --- a/spec/fixtures/not_1.9.1/example_net_http.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- !ruby/object:Net::HTTP -address: example.com -close_on_empty_response: false -curr_http_version: "1.1" -debug_output: -newimpl: true -open_timeout: -port: 80 -read_timeout: 60 -seems_1_0_server: false -socket: -ssl_context: -started: true -use_ssl: false diff --git a/spec/fixtures/not_1.9.1/example_net_http_request.yml b/spec/fixtures/not_1.9.1/example_net_http_request.yml deleted file mode 100644 index 1aafc6a4..00000000 --- a/spec/fixtures/not_1.9.1/example_net_http_request.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- !ruby/object:Net::HTTP::Post -body: id=7 -body_stream: -header: - accept: - - "*/*" - content-type: - - application/x-www-form-urlencoded -method: POST -path: / -request_has_body: true -response_has_body: true diff --git a/spec/fixtures/not_1.9.1/example_net_http_response.yml b/spec/fixtures/not_1.9.1/example_net_http_response.yml deleted file mode 100644 index fdb87db5..00000000 --- a/spec/fixtures/not_1.9.1/example_net_http_response.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- !ruby/object:Net::HTTPOK -body: The response from example.com -body_exist: true -code: "200" -header: - last-modified: - - Tue, 15 Nov 2005 13:24:10 GMT - connection: - - close - date: - - Wed, 31 Mar 2010 02:43:26 GMT - content-type: - - text/html; charset=UTF-8 - etag: - - "\"24ec5-1b6-4059a80bfd280\"" - server: - - Apache/2.2.3 (CentOS) - content-length: - - "438" - accept-ranges: - - bytes -http_version: "1.1" -message: OK -read: true -socket: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d4eacc49..205c7dd8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,9 +8,6 @@ require 'rspec' -# Ruby 1.9.1 has a different yaml serialization format. -YAML_SERIALIZATION_VERSION = RUBY_VERSION == '1.9.1' ? '1.9.1' : 'not_1.9.1' - Dir['./spec/support/**/*.rb'].each { |f| require f } require 'vcr' @@ -42,7 +39,7 @@ def reset!(stubbing_lib = :fakeweb) RSpec.configure do |config| config.color_enabled = true - config.debug = (using_git && RUBY_INTERPRETER == :mri && !%w[ 1.9.1 1.9.3 ].include?(RUBY_VERSION) && !ENV['CI']) + config.debug = (using_git && RUBY_INTERPRETER == :mri && !%w[ 1.9.3 ].include?(RUBY_VERSION) && !ENV['CI']) config.treat_symbols_as_metadata_keys_with_true_values = true tmp_dir = File.expand_path('../../tmp/cassette_library_dir', __FILE__) diff --git a/spec/support/shared_example_groups/http_library.rb b/spec/support/shared_example_groups/http_library.rb index c74d2c6d..cd90e23f 100644 --- a/spec/support/shared_example_groups/http_library.rb +++ b/spec/support/shared_example_groups/http_library.rb @@ -99,7 +99,7 @@ def self.test_url(description, url) describe '.stub_requests using specific match_attributes' do before(:each) { subject.http_connections_allowed = false } - let(:interactions) { VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', YAML_SERIALIZATION_VERSION, 'match_requests_on.yml')) } + let(:interactions) { VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', 'match_requests_on.yml')) } @supported_request_match_attributes = supported_request_match_attributes def self.matching_on(attribute, valid, invalid, &block) @@ -287,7 +287,7 @@ def test_request_stubbed(method, url, expected) context 'when some requests are stubbed, after setting a checkpoint' do before(:each) do subject.create_stubs_checkpoint(:my_checkpoint) - @recorded_interactions = VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', YAML_SERIALIZATION_VERSION, 'fake_example.com_responses.yml')) + @recorded_interactions = VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', 'fake_example.com_responses.yml')) subject.stub_requests(@recorded_interactions, VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES) end diff --git a/spec/support/shared_example_groups/http_stubbing_adapter.rb b/spec/support/shared_example_groups/http_stubbing_adapter.rb index 2ee123a9..f37981be 100644 --- a/spec/support/shared_example_groups/http_stubbing_adapter.rb +++ b/spec/support/shared_example_groups/http_stubbing_adapter.rb @@ -60,7 +60,7 @@ def adapter_enabled?(adapter) end describe '.request_stubbed? using specific match_attributes' do - let(:interactions) { VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', YAML_SERIALIZATION_VERSION, 'match_requests_on.yml')) } + let(:interactions) { VCR::YAML.load_file(File.join(VCR::SPEC_ROOT, 'fixtures', 'match_requests_on.yml')) } @supported_request_match_attributes = supported_request_match_attributes def self.matching_on(attribute, valid1, valid2, invalid, &block) diff --git a/spec/vcr/cassette_spec.rb b/spec/vcr/cassette_spec.rb index 2d1ac387..39e62a93 100644 --- a/spec/vcr/cassette_spec.rb +++ b/spec/vcr/cassette_spec.rb @@ -49,7 +49,7 @@ describe '.new' do it 'raises an error with a helpful message when loading an old unsupported cassette' do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures" expect { VCR::Cassette.new('0_3_1_cassette') }.to raise_error(/The VCR cassette 0_3_1_cassette.yml uses an old format that is now deprecated/) end @@ -64,7 +64,7 @@ end it 'does not raise an error in the case of an empty file' do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR::Cassette.new('empty', :record => :none).recorded_interactions.should eq([]) end @@ -131,7 +131,7 @@ context "when :#{record_mode} is passed as the record option" do if record_mode == :none it 'does not allow http connections when there is an existing cassette file with recorded interactions' do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_receive(:http_connections_allowed=).with(false) c = VCR::Cassette.new('example', :record => :once) File.should exist(c.file) @@ -139,7 +139,7 @@ end it 'allows http connections when there is an empty existing cassette file' do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_receive(:http_connections_allowed=).with(true) c = VCR::Cassette.new('empty', :record => :once) File.should exist(c.file) @@ -147,7 +147,7 @@ end it 'allows http connections when there is not an existing cassette file' do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_receive(:http_connections_allowed=).with(true) c = VCR::Cassette.new('non_existant_file', :record => :once) File.should_not exist(c.file) @@ -158,7 +158,7 @@ let(:interaction_1) { VCR::HTTPInteraction.new(VCR::Request.new(:get, 'http://example.com/'), VCR::Response.new(VCR::ResponseStatus.new)) } let(:interaction_2) { VCR::HTTPInteraction.new(VCR::Request.new(:get, 'http://example.com/'), VCR::Response.new(VCR::ResponseStatus.new)) } let(:interactions) { [interaction_1, interaction_2] } - before(:each) { VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" } + before(:each) { VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" } it 'updates the content_length headers when given :update_content_length_header => true' do VCR::YAML.stub(:load => interactions) @@ -231,13 +231,13 @@ uri.to_s !~ /example\.com/ end - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" cassette = VCR::Cassette.new('with_localhost_requests', :record => record_mode) cassette.recorded_interactions.map { |i| URI.parse(i.uri).host }.should eq(%w[example.com]) end it "loads the recorded interactions from the library yml file" do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" cassette = VCR::Cassette.new('example', :record => record_mode) cassette.should have(3).recorded_interactions @@ -275,25 +275,25 @@ c.before_playback { |i| i.ignore! if i.request.uri =~ /foo/ } end - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" cassette = VCR::Cassette.new('example', :record => record_mode) cassette.should have(2).recorded_interactions end it "stubs the recorded requests with the http stubbing adapter" do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_receive(:stub_requests).with([an_instance_of(VCR::HTTPInteraction)]*3, anything) VCR::Cassette.new('example', :record => record_mode) end it "passes the :match_request_on option to #stub_requests" do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_receive(:stub_requests).with(anything, [:body, :headers]) VCR::Cassette.new('example', :record => record_mode, :match_requests_on => [:body, :headers]) end else it "does not stub the recorded requests with the http stubbing adapter" do - VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + VCR::Config.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" VCR.http_stubbing_adapter.should_not_receive(:stub_requests) VCR::Cassette.new('example', :record => record_mode) end @@ -388,7 +388,7 @@ subject { VCR::Cassette.new('example', :record => record_mode, :match_requests_on => [:uri]) } before(:each) do - base_dir = "#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/cassette_spec" + base_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec" FileUtils.cp(base_dir + "/example.yml", VCR::Config.cassette_library_dir + "/example.yml") end diff --git a/spec/vcr/structs/request_spec.rb b/spec/vcr/structs/request_spec.rb index 8155684f..0b8f9f79 100644 --- a/spec/vcr/structs/request_spec.rb +++ b/spec/vcr/structs/request_spec.rb @@ -32,8 +32,8 @@ end describe '.from_net_http_request' do - let(:net_http) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/example_net_http.yml") } - let(:request) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/example_net_http_request.yml") } + let(:net_http) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/example_net_http.yml") } + let(:request) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/example_net_http_request.yml") } subject { described_class.from_net_http_request(net_http, request) } before(:each) do diff --git a/spec/vcr/structs/response_spec.rb b/spec/vcr/structs/response_spec.rb index dbf1ce47..1a22f844 100644 --- a/spec/vcr/structs/response_spec.rb +++ b/spec/vcr/structs/response_spec.rb @@ -2,7 +2,7 @@ describe VCR::Response do describe '.from_net_http_response' do - let(:response) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/example_net_http_response.yml") } + let(:response) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/example_net_http_response.yml") } subject { described_class.from_net_http_response(response) } it { should be_instance_of(described_class) } diff --git a/spec/vcr/structs/response_status_spec.rb b/spec/vcr/structs/response_status_spec.rb index 2c909a4e..2e7e2be6 100644 --- a/spec/vcr/structs/response_status_spec.rb +++ b/spec/vcr/structs/response_status_spec.rb @@ -2,7 +2,7 @@ describe VCR::ResponseStatus do describe '.from_net_http_response' do - let(:response) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/#{YAML_SERIALIZATION_VERSION}/example_net_http_response.yml") } + let(:response) { VCR::YAML.load_file("#{VCR::SPEC_ROOT}/fixtures/example_net_http_response.yml") } subject { described_class.from_net_http_response(response) } it { should be_instance_of(described_class) }