File tree Expand file tree Collapse file tree 1 file changed +23
-20
lines changed Expand file tree Collapse file tree 1 file changed +23
-20
lines changed Original file line number Diff line number Diff line change @@ -5,27 +5,30 @@ module RSpec
55 module Metadata
66 extend self
77
8+ def vcr_cassette_name_for ( metadata )
9+ description =
10+ if metadata [ :description ] . empty?
11+ # we have an "it { is_expected.to be something }" block
12+ metadata [ :scoped_id ]
13+ else
14+ metadata [ :description ]
15+ end
16+ example_group =
17+ if metadata . key? ( :example_group )
18+ metadata [ :example_group ]
19+ else
20+ metadata [ :parent_example_group ]
21+ end
22+
23+ if example_group
24+ [ vcr_cassette_name_for ( example_group ) , description ] . join ( '/' )
25+ else
26+ description
27+ end
28+ end
29+
830 def configure!
931 ::RSpec . configure do |config |
10- vcr_cassette_name_for = lambda do |metadata |
11- description = if metadata [ :description ] . empty?
12- # we have an "it { is_expected.to be something }" block
13- metadata [ :scoped_id ]
14- else
15- metadata [ :description ]
16- end
17- example_group = if metadata . key? ( :example_group )
18- metadata [ :example_group ]
19- else
20- metadata [ :parent_example_group ]
21- end
22-
23- if example_group
24- [ vcr_cassette_name_for [ example_group ] , description ] . join ( '/' )
25- else
26- description
27- end
28- end
2932
3033 when_tagged_with_vcr = { :vcr => lambda { |v | !!v } }
3134
@@ -45,7 +48,7 @@ def configure!
4548 end
4649
4750 cassette_name ||= options . delete ( :cassette_name ) ||
48- vcr_cassette_name_for [ example . metadata ]
51+ VCR :: RSpec :: Metadata . vcr_cassette_name_for ( example . metadata )
4952 VCR . insert_cassette ( cassette_name , options )
5053 end
5154
You can’t perform that action at this time.
0 commit comments