Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the RSpec cassette name shorthand #821

Merged
merged 1 commit into from
May 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions features/test_frameworks/rspec_metadata.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ Feature: Usage with RSpec metadata
string. It will set the cassette name based on the example's
full description.

If you need to override the cassette name or options, you can pass a
hash (`:vcr => { ... }`).
You can override the cassette name by passing a string
(`:vcr => 'my_cassette'`).

If you need to override the other options, you can pass a hash
(`:vcr => { ... }`).

Background:
Given a file named "spec/spec_helper.rb" with:
Expand Down Expand Up @@ -77,6 +80,10 @@ Feature: Usage with RSpec metadata
expect(make_http_request).to eq('Hello')
end

it 'records an http request with a custom file name', :vcr => 'my_cassette' do
expect(make_http_request).to eql('Hello')
end

context 'in a nested example group' do
it 'records another one' do
expect(make_http_request).to eq('Hello')
Expand All @@ -91,9 +98,10 @@ Feature: Usage with RSpec metadata
end
"""
When I run `rspec spec/vcr_example_spec.rb`
Then it should pass with "4 examples, 0 failures"
Then it should pass with "5 examples, 0 failures"
And the file "spec/cassettes/VCR_example_group_metadata/records_an_http_request.yml" should contain "Hello"
And the file "spec/cassettes/VCR_example_group_metadata/records_another_http_request.yml" should contain "Hello"
And the file "spec/cassettes/my_cassette.yml" should contain "Hello"
And the file "spec/cassettes/VCR_example_group_metadata/in_a_nested_example_group/records_another_one.yml" should contain "Hello"
And the file "spec/cassettes/VCR_example_metadata/records_an_http_request.yml" should contain "Hello"

Expand Down