Skip to content

Do not mask error when ignore_cassettes is true#952

Open
stephenprater wants to merge 1 commit into
vcr:masterfrom
stephenprater:mask-error-when-ignore
Open

Do not mask error when ignore_cassettes is true#952
stephenprater wants to merge 1 commit into
vcr:masterfrom
stephenprater:mask-error-when-ignore

Conversation

@stephenprater

Copy link
Copy Markdown

When turning VCR cassettes off and using ignore_cassettes: true any use_cassette blocks will be executed as normal. But if an error is raised within the test - that error will be caught in the use_cassette method. The cassette in this method will not exist, because the ignore_cassettes flag causes it to not be inserted. A NoMethodError will be raised when VCR attempts to call run_failed! on the non-existent cassette.

Let's use the safe navigation operator to conditionally not mark a cassette as failed if it doesn't exist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant