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 +4 -4
- data/README.md +16 -3
- data/lib/vcr_assistant/cassette.rb +7 -6
- data/lib/vcr_assistant/test_helpers.rb +2 -2
- data/vcr_assistant.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ff37258830bb6676f169c89cd2d137484ae1938
|
4
|
+
data.tar.gz: b9c2445c93bf62acc89c10baa628b8b4d62be551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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/
|
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
|
data/vcr_assistant.gemspec
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vcr
|