Permalink
Browse files

Excluded the server name from being matched for VCR requests. Tests s…

…hould now pass in Travis...
  • Loading branch information...
visoft committed Aug 11, 2012
1 parent 15e4fac commit fe938ad56630a3dc488985fd314adb3f4e30b50a
@@ -12,7 +12,7 @@ Scenario: Entity should fill values on protected resource
Given I call "AddToCategories" on the service with a new "Category" object with Name: "Auth Test Category"
And I save changes
And I call "Categories" on the service with args: "1"
- When I run the query
+ When I run the query within a cassette named "basic_auth_protected_resource"
Then the method "Id" on the first result should equal: "1"
And the method "Name" on the first result should equal: "Auth Test Category"

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,9 +1,13 @@
require "vcr"
+require File.expand_path("../../../spec/support/sample_service_matcher", __FILE__)
VCR.configure do |c|
c.hook_into :webmock
c.cassette_library_dir = "features/cassettes"
- c.default_cassette_options = { :record => :none }
+ c.default_cassette_options = {
+ :record => :none,
+ :match_requests_on => [:method, OData::Support::SampleServiceMatcher]
+ }
end
VCR.cucumber_tags do |t|
@@ -0,0 +1,15 @@
+require 'uri'
+
+module OData
+ module Support
+ class SampleServiceMatcher
+ def self.call(req1, req2)
+ regexp = /^(https?:\/\/(?:[^@]*@)?)[^:]*(:\d+\/.*$)/i
+ request1 = req1.uri.match(regexp)
+ request2 = req2.uri.match(regexp)
+
+ (request1[1] == request2[1]) && (request1[2] == request2[2])
+ end
+ end
+ end
+end

0 comments on commit fe938ad

Please sign in to comment.