minitest-vcr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.coveralls.yml ADDED
File without changes
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'coveralls', require: false
4
+
3
5
  # Specify your gem's dependencies in minitest-vcr.gemspec
4
6
  gemspec
5
7
 
data/README.md CHANGED
@@ -1,19 +1,22 @@
1
1
  minitest-vcr
2
2
  ============
3
-
4
- [![Build Status](https://travis-ci.org/mfpiccolo/minitest-vcr.png?branch=master)](https://travis-ci.org/mfpiccolo/minitest-vcr)
5
-
6
- * [Homepage](http://mfpiccolo.github.io/minitest-vcr)
7
- * [Issues](https://github.com/mfpiccolo/minitest-vcr/issues)
8
- * [Documentation](http://rubydoc.info/gems/minitest-vcr/frames)
9
- * [Email](mailto:mfpiccolo@gmail.com)
3
+ | Project | Gem Release |
4
+ |------------------------ | ----------------- |
5
+ | Gem name | minitest-vcr |
6
+ | License | [MIT](LICENSE.txt) |
7
+ | Version | [![Gem Version](https://badge.fury.io/rb/minitest-vcr.png)](http://badge.fury.io/rb/minitest-vcr) |
8
+ | Continuous Integration | [![Build Status](https://travis-ci.org/mfpiccolo/minitest-vcr.png?branch=master)](https://travis-ci.org/mfpiccolo/minitest-vcr)
9
+ | Test Coverage | [![Coverage Status](https://coveralls.io/repos/mfpiccolo/minitest-vcr/badge.png?branch=master)](https://coveralls.io/r/mfpiccolo/minitest-vcr?branch=coveralls)
10
+ | Grade | [![Code Climate](https://codeclimate.com/github/mfpiccolo/minitest-vcr.png)](https://codeclimate.com/github/mfpiccolo/minitest-vcr)
11
+ | Dependencies | [![Dependency Status](https://gemnasium.com/mfpiccolo/minitest-vcr.png)](https://gemnasium.com/mfpiccolo/minitest-vcr)
12
+ | Homepage | [http://mfpiccolo.github.io/minitest-vcr][homepage] |
13
+ | Documentation | [http://rdoc.info/github/mfpiccolo/minitest-vcr/frames][documentation] |
14
+ | Issues | [https://github.com/mfpiccolo/minitest-vcr/issues][issues] |
10
15
 
11
16
  ## Description
12
17
 
13
18
  Allows VCR to automatically make cassetes with proper file paths using Minitest.
14
19
 
15
- ## Features
16
-
17
20
  ## Examples
18
21
 
19
22
  Two main steps:
@@ -21,7 +24,7 @@ Two main steps:
21
24
  1. Install and require the gem
22
25
  2. Add `MinitestVcr::Spec.configure!` before your tests load
23
26
 
24
- The setup below will create a direcotry structre that looks like this:
27
+ The setup below will create a directory structre that looks like this:
25
28
 
26
29
  |-- app_name
27
30
  | |-- test/
@@ -113,5 +116,10 @@ See [LICENSE.txt](LICENSE.txt) for details.
113
116
  4. Push to the branch (`git push origin my-new-feature`)
114
117
  5. Create new Pull Request
115
118
 
116
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mfpiccolo/minitest-vcr/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
119
+ [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/e1a155a07163d56ca0c4f246c7aa8766 "githalytics.com")](http://githalytics.com/mfpiccolo/minitest-vcr)
120
+
121
+ [license]: https://github.com/mfpiccolo/minitest-vcr/MIT-LICENSE
122
+ [homepage]: http://mfpiccolo.github.io/minitest-vcr
123
+ [documentation]: http://rdoc.info/github/mfpiccolo/minitest-vcr/frames
124
+ [issues]: https://github.com/mfpiccolo/minitest-vcr/issues
117
125
 
@@ -0,0 +1,21 @@
1
+ class String
2
+
3
+ def vcr_path(example, spec_name)
4
+ self.scan(/^(.*?)::[abc]/) 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,31 +1,17 @@
1
1
  require "vcr"
2
2
  require "minispec-metadata"
3
+ require "extensions/string"
3
4
 
4
5
  module MinitestVcr
5
6
  module Spec
6
7
 
7
8
  def self.configure!
8
9
  run_before = lambda do |example|
9
- if metadata[:vcr]
10
- example.class.name.scan(/^(.*?)::[abc]/) do |name|
11
- @class_name = name.first
12
- end
13
-
14
- if @class_name.nil?
15
- test_info = example.class.name.split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"]
16
- @class_name = ""
17
- else
18
- test_info = example.class.name.gsub(@class_name, "").split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"]
19
- end
20
-
21
- VCR.insert_cassette @class_name + "/" + test_info.join("/") + "/#{spec_name}"
22
- end
10
+ VCR.insert_cassette example.class.name.vcr_path(example, spec_name) if metadata[:vcr]
23
11
  end
24
12
 
25
13
  run_after = lambda do |example|
26
- if metadata[:vcr]
27
- ::VCR.eject_cassette
28
- end
14
+ ::VCR.eject_cassette if metadata[:vcr]
29
15
  end
30
16
 
31
17
  ::MiniTest::Spec.before :each, &run_before
@@ -1,3 +1,3 @@
1
1
  module MinitestVcr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -25,15 +25,15 @@ http_interactions:
25
25
  Content-Type:
26
26
  - text/html
27
27
  Date:
28
- - Tue, 14 Jan 2014 05:14:35 GMT
28
+ - Wed, 15 Jan 2014 16:51:17 GMT
29
29
  Etag:
30
30
  - ! '"359670651"'
31
31
  Expires:
32
- - Tue, 21 Jan 2014 05:14:35 GMT
32
+ - Wed, 22 Jan 2014 16:51:17 GMT
33
33
  Last-Modified:
34
34
  - Fri, 09 Aug 2013 23:54:35 GMT
35
35
  Server:
36
- - ECS (sea/F622)
36
+ - ECS (sjc/4FCE)
37
37
  X-Cache:
38
38
  - HIT
39
39
  X-Ec-Custom-Error:
@@ -60,5 +60,5 @@ http_interactions:
60
60
  or asking for permission.</p>\n <p><a href=\"http://www.iana.org/domains/example\">More
61
61
  information...</a></p>\n</div>\n</body>\n</html>\n"
62
62
  http_version:
63
- recorded_at: Tue, 14 Jan 2014 05:14:36 GMT
63
+ recorded_at: Wed, 15 Jan 2014 16:51:17 GMT
64
64
  recorded_with: VCR 2.8.0
@@ -25,15 +25,15 @@ http_interactions:
25
25
  Content-Type:
26
26
  - text/html
27
27
  Date:
28
- - Tue, 14 Jan 2014 05:14:36 GMT
28
+ - Wed, 15 Jan 2014 16:51:18 GMT
29
29
  Etag:
30
30
  - ! '"359670651"'
31
31
  Expires:
32
- - Tue, 21 Jan 2014 05:14:36 GMT
32
+ - Wed, 22 Jan 2014 16:51:18 GMT
33
33
  Last-Modified:
34
34
  - Fri, 09 Aug 2013 23:54:35 GMT
35
35
  Server:
36
- - ECS (sea/55ED)
36
+ - ECS (sjc/4FCE)
37
37
  X-Cache:
38
38
  - HIT
39
39
  X-Ec-Custom-Error:
@@ -60,5 +60,5 @@ http_interactions:
60
60
  or asking for permission.</p>\n <p><a href=\"http://www.iana.org/domains/example\">More
61
61
  information...</a></p>\n</div>\n</body>\n</html>\n"
62
62
  http_version:
63
- recorded_at: Tue, 14 Jan 2014 05:14:36 GMT
63
+ recorded_at: Wed, 15 Jan 2014 16:51:17 GMT
64
64
  recorded_with: VCR 2.8.0
@@ -0,0 +1,18 @@
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
data/test/helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  begin
2
5
  require "bundler"
3
6
  rescue LoadError => e
@@ -41,8 +41,8 @@ describe MinitestVcr::Spec do
41
41
  describe "#configure!", :vcr do
42
42
 
43
43
  before do
44
- ::MiniTest::Spec.expects(:before).with(:each).returns(:true)
45
- ::MiniTest::Spec.expects(:after).with(:each).returns(true)
44
+ ::MiniTest::Spec.expects(:before).with(:each)
45
+ ::MiniTest::Spec.expects(:after).with(:each)
46
46
  end
47
47
 
48
48
  it "should call before and after with proper args and block" do
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: minitest-vcr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mike Piccolo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-14 00:00:00.000000000 Z
12
+ date: 2014-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vcr
@@ -258,18 +258,21 @@ executables: []
258
258
  extensions: []
259
259
  extra_rdoc_files: []
260
260
  files:
261
+ - .coveralls.yml
261
262
  - .gitignore
262
263
  - .travis.yml
263
264
  - Gemfile
264
265
  - LICENSE.txt
265
266
  - README.md
266
267
  - Rakefile
268
+ - lib/extensions/string.rb
267
269
  - lib/minitest-vcr.rb
268
270
  - lib/minitest-vcr/spec.rb
269
271
  - lib/minitest-vcr/version.rb
270
272
  - minitest-vcr.gemspec
271
273
  - test/cassettes/MinitestVcr_Spec/a_describe_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
272
274
  - test/cassettes/MinitestVcr_Spec/an_it_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
275
+ - test/extensions/string_test.rb
273
276
  - test/helper.rb
274
277
  - test/minitest-vcr/spec_test.rb
275
278
  homepage: ''
@@ -300,6 +303,7 @@ summary: Allows VCR to automatically make cassetes with proper file paths with M
300
303
  test_files:
301
304
  - test/cassettes/MinitestVcr_Spec/a_describe_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
302
305
  - test/cassettes/MinitestVcr_Spec/an_it_with_metadata/with_a_nested_example_group/uses_a_cassette_for_any_examples.yml
306
+ - test/extensions/string_test.rb
303
307
  - test/helper.rb
304
308
  - test/minitest-vcr/spec_test.rb
305
309
  has_rdoc: