Skip to content

Commit

Permalink
Remove enforcing vcr: true for feature specs
Browse files Browse the repository at this point in the history
VCR was enforced for feature specs. This happened trying to make VCR the
default for feature specs.

Instead of fixing the code and making VCR the default for feature specs,
remove enforcing of VCR for feature specs. This way, the `vcr:` flag is
used like in the rest of the tests, and for those tests which don't need
VCR there is no need to use `vcr: false`. We simply don't define any
`vcr:` flag.
  • Loading branch information
eduardoj committed Mar 31, 2023
1 parent 5ea491e commit 13fd87d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/api/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ Otherwise the cassette will not match and VCR tries record a new cassette each t
let(:apache_project) { create(:project, name: 'Apache') }
```

#### Enable VCR for Model and Controller Specs
#### Enable VCR

To make loading tests faster, we only include VCR in feature tests by default.
However, sometimes you also get and want to verify a backend response in a model or controller test.
You may want to store a backend response in a spec test.
Make sure you enable VCR in the test metadata like this:

```
Expand Down
3 changes: 0 additions & 3 deletions src/api/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@
# the seed, which is printed after each run.
config.order = :random

# Tag all groups and examples in the spec/features directory with :vcr => :true
#
# CAPYBARA_DRIVER => choose one of existing drivers: ['desktop', 'mobile']
# If you want to run the feature tests for mobile, you need to specify the driver
# environment variable. By default it is :desktop.
config.define_derived_metadata(file_path: %r{/spec/features/}) do |metadata|
metadata[:vcr] = true
metadata[:driver] = ENV.fetch('CAPYBARA_DRIVER', 'desktop').to_sym
end

Expand Down

0 comments on commit 13fd87d

Please sign in to comment.