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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +13 -0
- data/lib/minitest-vcr/spec.rb +28 -5
- data/lib/minitest-vcr/version.rb +1 -1
- data/minitest-vcr.gemspec +0 -4
- data/test/helper.rb +0 -2
- data/test/minitest-vcr/spec_test.rb +3 -0
- metadata +3 -48
- data/lib/extensions/string.rb +0 -21
- data/test/extensions/string_test.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfe1b3b546e4be9fc1ed17877b8a3aca4ffbc59
|
4
|
+
data.tar.gz: c6d69da87be3c09d2575543effccef55a01dbf98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b92a0911d3ad115b939cdbb1fea4592cffe287649e268ab113d02b08ca223e218e0add9062a5f14b90e0b97e7d835dd22f7f46f06eaa5b5ea4dbc1488e0bce35
|
7
|
+
data.tar.gz: af4f65991a6b9cd84f10e396a863eb377226f41e6e82f68e3a49dd0c2a358627da334be215b65fb3b6650889a76529a895e8384298d6741139e28500055229e4
|
data/.travis.yml
CHANGED
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
|
|
data/lib/minitest-vcr/spec.rb
CHANGED
@@ -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
|
-
|
12
|
-
|
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
|
data/lib/minitest-vcr/version.rb
CHANGED
data/minitest-vcr.gemspec
CHANGED
@@ -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
|
data/test/helper.rb
CHANGED
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.
|
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-
|
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.
|
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:
|
data/lib/extensions/string.rb
DELETED
@@ -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
|