minitest-vcr 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80058c2e8c3e0c57d535cac93e063ec57006cd9c
4
- data.tar.gz: 7c7eb3fe3472a6abffcd944d09b304ce788b5424
3
+ metadata.gz: 7bfe1b3b546e4be9fc1ed17877b8a3aca4ffbc59
4
+ data.tar.gz: c6d69da87be3c09d2575543effccef55a01dbf98
5
5
  SHA512:
6
- metadata.gz: 0ff88ba8850921e866a3432725ce39b898ca426527ec1f2121480114a11fe98860094de7f77360bff28f5976605fefe170049bfee41f00a2beaf188ff53431fb
7
- data.tar.gz: d0a25b0e90d20b9d2a17eccf2a4ed2066c3265f62c5a942709a3524a008bcb038259ee34992e89a08d50ff3c55b432a61927fe96157f5fbf6691a95381aa9154
6
+ metadata.gz: b92a0911d3ad115b939cdbb1fea4592cffe287649e268ab113d02b08ca223e218e0add9062a5f14b90e0b97e7d835dd22f7f46f06eaa5b5ea4dbc1488e0bce35
7
+ data.tar.gz: af4f65991a6b9cd84f10e396a863eb377226f41e6e82f68e3a49dd0c2a358627da334be215b65fb3b6650889a76529a895e8384298d6741139e28500055229e4
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
4
  - 2.0.0
5
+ - 2.1.3
6
6
 
7
7
  script: bundle exec rake
data/README.md CHANGED
@@ -75,6 +75,19 @@ describe Example::Spec do
75
75
  end
76
76
  end
77
77
  end
78
+
79
+ # setting config
80
+ describe 'an example group', vcr: { record: :all } do
81
+ describe 'with a nested example group' do
82
+ before do
83
+ conn = Faraday.new
84
+ @response = conn.get 'http://example.com'
85
+ end
86
+ it 'uses a cassette for any examples' do
87
+ @response.wont_equal nil
88
+ end
89
+ end
90
+ end
78
91
  end
79
92
  ```
80
93
 
@@ -1,20 +1,19 @@
1
1
  require "vcr"
2
2
  require "minispec-metadata"
3
- require "extensions/string"
4
- require "database_cleaner"
5
3
 
6
4
  module MinitestVcr
7
5
  module Spec
8
6
 
9
7
  def self.configure!
10
8
  run_before = lambda do |example|
11
- DatabaseCleaner.start rescue DatabaseCleaner::NoORMDetected
12
- VCR.insert_cassette example.class.name.vcr_path(example, spec_name) if metadata[:vcr]
9
+ if metadata[:vcr]
10
+ options = metadata[:vcr].is_a?(Hash) ? metadata[:vcr] : {}
11
+ VCR.insert_cassette StringHelpers.vcr_path(example.class.name, example, spec_name), options
12
+ end
13
13
  end
14
14
 
15
15
  run_after = lambda do |example|
16
16
  ::VCR.eject_cassette if metadata[:vcr]
17
- DatabaseCleaner.clean rescue DatabaseCleaner::NoORMDetected
18
17
  end
19
18
 
20
19
  ::MiniTest::Spec.before :each, &run_before
@@ -22,4 +21,28 @@ module MinitestVcr
22
21
  end
23
22
 
24
23
  end # Spec
24
+
25
+ module StringHelpers
26
+
27
+ def self.vcr_path(example_class_name, example, spec_name)
28
+ example_class_name.scan(/^(.*?)::[#a-z]/) do |class_names|
29
+ class_name = class_names.flatten.first
30
+
31
+ if class_name.nil?
32
+ @path = prep example.class.name
33
+ else
34
+ @path = prep(example.class.name.gsub(class_name, "")).unshift(class_name)
35
+ end
36
+ end
37
+
38
+ @path.push(spec_name).join("/") unless @path.nil?
39
+ end
40
+
41
+ protected
42
+
43
+ def self.prep string
44
+ string.split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"]
45
+ end
46
+
47
+ end
25
48
  end # MinitestVcr
@@ -1,3 +1,3 @@
1
1
  module MinitestVcr
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -22,8 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "minitest", ">= 4.7.5"
23
23
  spec.add_dependency "minispec-metadata", "~> 2.0"
24
24
 
25
- spec.add_runtime_dependency "database_cleaner", ">= 1.0"
26
-
27
25
  spec.add_development_dependency "bundler", "~> 1.5"
28
26
  spec.add_development_dependency "rake", "~> 10.0"
29
27
  spec.add_development_dependency "mocha", "~> 1.0"
@@ -31,6 +29,4 @@ Gem::Specification.new do |spec|
31
29
  spec.add_development_dependency "rubygems-tasks", "~> 0.2"
32
30
  spec.add_development_dependency "yard", "~> 0.8"
33
31
  spec.add_development_dependency "webmock", "~> 1.17"
34
- spec.add_development_dependency "pry", " ~> 0.9"
35
- spec.add_development_dependency "pry-debugger", "~> 0.2"
36
32
  end
@@ -24,8 +24,6 @@ require "minitest-vcr"
24
24
  require "webmock"
25
25
  require "mocha/setup"
26
26
  require "faraday"
27
- require "pry"
28
- require "pry-debugger"
29
27
 
30
28
  VCR.configure do |c|
31
29
  c.cassette_library_dir = 'test/cassettes'
@@ -35,6 +35,9 @@ describe MinitestVcr::Spec do
35
35
  'uses a cassette for any examples'
36
36
  ])
37
37
  end
38
+ it 'can supply metadata', vcr: {record: :all} do
39
+ VCR.current_cassette.record_mode.must_equal :all
40
+ end
38
41
  end
39
42
  end
40
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-vcr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Piccolo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-10 00:00:00.000000000 Z
11
+ date: 2014-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
- - !ruby/object:Gem::Dependency
56
- name: database_cleaner
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: bundler
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,34 +150,6 @@ dependencies:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
152
  version: '1.17'
167
- - !ruby/object:Gem::Dependency
168
- name: pry
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '0.9'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '0.9'
181
- - !ruby/object:Gem::Dependency
182
- name: pry-debugger
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '0.2'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '0.2'
195
153
  description: I like MiniTest. I like VCR. I like not having to manage cassetes.
196
154
  email:
197
155
  - mpiccolo@newleaders.com
@@ -206,14 +164,12 @@ files:
206
164
  - LICENSE.txt
207
165
  - README.md
208
166
  - Rakefile
209
- - lib/extensions/string.rb
210
167
  - lib/minitest-vcr.rb
211
168
  - lib/minitest-vcr/spec.rb
212
169
  - lib/minitest-vcr/version.rb
213
170
  - minitest-vcr.gemspec
214
171
  - test/cassettes/MinitestVcr_Spec/a_describe_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
215
172
  - test/cassettes/MinitestVcr_Spec/an_it_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
216
- - test/extensions/string_test.rb
217
173
  - test/helper.rb
218
174
  - test/minitest-vcr/spec_test.rb
219
175
  homepage: ''
@@ -236,14 +192,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
192
  version: '0'
237
193
  requirements: []
238
194
  rubyforge_project:
239
- rubygems_version: 2.2.1
195
+ rubygems_version: 2.2.2
240
196
  signing_key:
241
197
  specification_version: 4
242
198
  summary: Allows VCR to automatically make cassetes with proper file paths with MiniTest
243
199
  test_files:
244
200
  - test/cassettes/MinitestVcr_Spec/a_describe_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
245
201
  - test/cassettes/MinitestVcr_Spec/an_it_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
246
- - test/extensions/string_test.rb
247
202
  - test/helper.rb
248
203
  - test/minitest-vcr/spec_test.rb
249
204
  has_rdoc:
@@ -1,21 +0,0 @@
1
- class String
2
-
3
- def vcr_path(example, spec_name)
4
- self.scan(/^(.*?)::[#a-z]/) do |class_names|
5
- class_name = class_names.flatten.first
6
-
7
- if class_name.nil?
8
- @path = example.class.name.prep
9
- else
10
- @path = example.class.name.gsub(class_name, "").prep.unshift(class_name)
11
- end
12
- end
13
-
14
- @path.push(spec_name).join("/") unless @path.nil?
15
- end
16
-
17
- def prep
18
- split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"]
19
- end
20
-
21
- end
@@ -1,18 +0,0 @@
1
- require "helper"
2
-
3
- MinitestVcr::Spec.configure!
4
-
5
- describe String do
6
-
7
- describe "prep" do
8
- it "returns an array of descriptions" do
9
- "a describe with metadata::with a nested example group::uses a cassette for any examples"
10
- .prep.must_equal([
11
- 'a describe with metadata',
12
- 'with a nested example group',
13
- 'uses a cassette for any examples'
14
- ])
15
- end
16
- end
17
-
18
- end