rspectacular 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bd94cf6a973562baa3b3c210c05c8f924ebaa0b
4
- data.tar.gz: f2f44f7a62027945c2b64ff44e079a83ad2bb6b4
3
+ metadata.gz: dbca676ebd5bdf10dd56f4b3ef7d422fb9313ca8
4
+ data.tar.gz: 8baa6609ef0702eb293321f951ba0555b1aed3f7
5
5
  SHA512:
6
- metadata.gz: ce9c32d885010e73a2eeb2922fa00804ecfa98613c77d3225f78f18744d53bcd4a29966f5ba6cfe64e1a4faf7b76deebb450facfdd0444ad965cf34477f92f1b
7
- data.tar.gz: 05ea3b12713d0c15ad30bf3f894b7a441fb9a8b4d59d51f28e98c898d2bdb62c0d0a3bc45deb5200e9b5efc2072730f1f65a6ea75db78d3f0eeca5b18d62a355
6
+ metadata.gz: 325f12d1dbc0121d2067b07a650643c7b416d4ea0fd13b0cdaf13a21de79d9a0607c54d59f99897ca6abdf15fff397f33ee659cd988b1063f2437a487121c8f1
7
+ data.tar.gz: 59565e5e618aba521b6fa035aca3234dca67e34a360f348d94221212e0c9b336c809b664ca20687502e2a82ca47732b75803d88d88ae9c3f83c70b75dedb0284
@@ -4,6 +4,7 @@
4
4
 
5
5
  begin
6
6
  require 'vcr'
7
+ Dir[File.expand_path('../../vcr_matchers/**/*.rb', __FILE__)].each { |f| require f }
7
8
 
8
9
  begin
9
10
  require 'webmock'
@@ -0,0 +1,37 @@
1
+ module Rspectacular
2
+ module VcrMatchers
3
+ class UriWithoutTrailingId
4
+ attr_accessor :trailing_id_matcher
5
+
6
+ def initialize(trailing_id_matcher)
7
+ self.trailing_id_matcher = trailing_id_matcher
8
+ end
9
+
10
+ def call(request, vcr_cassette_request)
11
+ request_uri = request.uri
12
+ vcr_cassette_request_uri = vcr_cassette_request.uri
13
+
14
+ if request_uri.match(trailing_id_matcher)
15
+ request_uri_without_id = request_uri.sub trailing_id_matcher, ''
16
+ vcr_cassette_request_uri_without_id = vcr_cassette_request_uri.sub trailing_id_matcher, ''
17
+
18
+ request_uri.match(trailing_id_matcher) &&
19
+ vcr_cassette_request_uri.match(trailing_id_matcher) &&
20
+ request_uri_without_id == vcr_cassette_request_uri_without_id
21
+ else
22
+ request_uri == vcr_cassette_request_uri
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ VCR.configure do |config|
30
+ config.register_request_matcher :uri_without_trailing_guid do |request, vcr_cassette_request|
31
+ Rspectacular::VcrMatchers::UriWithoutTrailingId.new(%r(/[a-f0-9]{32}/?\z)).call(request, vcr_cassette_request)
32
+ end
33
+
34
+ config.register_request_matcher :uri_without_trailing_id do |request, vcr_cassette_request|
35
+ Rspectacular::VcrMatchers::UriWithoutTrailingId.new(%r(/\d+/?\z)).call(request, vcr_cassette_request)
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module RSpectacular
2
- VERSION = '0.36.0'
2
+ VERSION = '0.37.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-17 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -111,6 +111,7 @@ files:
111
111
  - lib/rspectacular/support/rails.rb
112
112
  - lib/rspectacular/support/random.rb
113
113
  - lib/rspectacular/support/selenium.rb
114
+ - lib/rspectacular/vcr_matchers/uri_without_trailing_id.rb
114
115
  - lib/rspectacular/version.rb
115
116
  - spec/spec_helper.rb
116
117
  homepage: https://github.com/jfelchner/rspectacular