vcr_assistant 0.1.1 → 0.2.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: b7948caad173d32a7e90dd3a5b311847adab806c
4
- data.tar.gz: db304bd5c31ec737fb26980243d6c3b5bcda2ed8
3
+ metadata.gz: 6ff37258830bb6676f169c89cd2d137484ae1938
4
+ data.tar.gz: b9c2445c93bf62acc89c10baa628b8b4d62be551
5
5
  SHA512:
6
- metadata.gz: cca530d286a145b0c44d291d30f27df30d5fc455a21066a63e777a482085939ee8e1e66f9f6bdebd1dab96d74abf267b6c23942af78477244f5c2e1ba5a4cc98
7
- data.tar.gz: bed351f6846cf7cc3b32ce7127fd1141255a802628c11f2ddb4d6b745543f73abf39cba047257e7688f0e05c033a035e18c1c5bb0b1423bdd9f67d8648a1b594
6
+ metadata.gz: ddca17537f335d0215add460b24d2650246b2a20838323ce5808c4472dd200ef7507d0b88382d7234022683fcc9fe28a1a599eed9ee18440d4ffce3793b0d737
7
+ data.tar.gz: 059865dd329fdafe432984a3646e67e20b961682a885310fb4f81a6f52e47ee93779affb9ecd7be7d7beed4c8e1ef055cc5385cf5d492a5a28207aefaeb43427
data/README.md CHANGED
@@ -42,13 +42,13 @@ end
42
42
  Add this line to your application's Gemfile:
43
43
 
44
44
  ```ruby
45
- gem 'vcr_assistant', '~> 0.1.1', :group => :test
45
+ gem 'vcr_assistant', '~> 0.2.0', :group => :test
46
46
  ```
47
47
 
48
48
  To have the `assisted_cassette` helper to be available in all specs, you can require `'vcr_assistant/rspec'` either in your Gemfile:
49
49
 
50
50
  ```ruby
51
- gem 'vcr_assistant', '~> 0.1.0',
51
+ gem 'vcr_assistant', '~> 0.2.0',
52
52
  :group => :test,
53
53
  :require => 'vcr_assistant/rspec'
54
54
  ```
@@ -83,6 +83,19 @@ it 'should make external HTTP calls' do |example|
83
83
  end
84
84
  ```
85
85
 
86
+ You can also pass through options for that specific VCR call as the last argument in both `assisted_cassette` and `VCRAssistant::Cassette.call`:
87
+
88
+ ```ruby
89
+ assisted_cassette example, :record => :new_episodes do |assistant|
90
+ # ...
91
+ end
92
+
93
+ # or, if specifying a label:
94
+ assisted_cassette example, :default, :record => :new_episodes do |assistant|
95
+ # ...
96
+ end
97
+ ```
98
+
86
99
  ### Custom assistants
87
100
 
88
101
  A standard assistant won't do anything much - you'll just get the advantage of automatically named cassettes. To have a custom assistant, you need to change the value of `VCRAssistant.assistant` to something that responds to `call` - perhaps a Proc or lambda - and then returns an object.
@@ -156,7 +169,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
156
169
 
157
170
  ## Contributing
158
171
 
159
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vcr_assistant. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
172
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pat/vcr_assistant. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
160
173
 
161
174
  ## Licence
162
175
 
@@ -1,14 +1,15 @@
1
1
  class VCRAssistant::Cassette
2
- def self.call(example, label = :default, &block)
3
- new(example, label, &block).call
2
+ def self.call(example, label = :default, options = {}, &block)
3
+ new(example, label, options, &block).call
4
4
  end
5
5
 
6
- def initialize(example, label, &block)
7
- @example, @label, @block = example, label, block
6
+ def initialize(example, label, options = {}, &block)
7
+ @example, @label, @options, @block = example, label, options, block
8
+ @label, @options = :default, label if label.is_a?(Hash)
8
9
  end
9
10
 
10
11
  def call
11
- VCR.use_cassette(file_name) do |vcr_cassette|
12
+ VCR.use_cassette(file_name, options) do |vcr_cassette|
12
13
  assistant = VCRAssistant.assistant.call label, vcr_cassette
13
14
 
14
15
  assistant.setup if assistant.respond_to?(:setup)
@@ -19,7 +20,7 @@ class VCRAssistant::Cassette
19
20
 
20
21
  private
21
22
 
22
- attr_reader :example, :label, :block
23
+ attr_reader :example, :label, :options, :block
23
24
 
24
25
  def file_name
25
26
  VCRAssistant.namer.call example
@@ -1,5 +1,5 @@
1
1
  module VCRAssistant::TestHelpers
2
- def assisted_cassette(example, &block)
3
- VCRAssistant::Cassette.call example, &block
2
+ def assisted_cassette(example, label = :default, options = {}, &block)
3
+ VCRAssistant::Cassette.call example, label, options, &block
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "vcr_assistant"
4
- spec.version = "0.1.1"
4
+ spec.version = "0.2.0"
5
5
  spec.authors = ["Pat Allan"]
6
6
  spec.email = ["pat@freelancing-gods.com"]
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcr_assistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-19 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr