Skip to content

Commit

Permalink
add to README about different cache directories
Browse files Browse the repository at this point in the history
  • Loading branch information
tansaku authored Sep 19, 2016
1 parent 3905cd6 commit 9f85277
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,22 @@ RSpec.configure do |config|
end
```

## Separate Cache Directory for Each Test (in Cucumber)

If you want the cache for each test to be independent, i.e. have it's own directory where the cache files are stored, you can use a Before tag like so:

```rb
Before('@javascript') do |scenario, block|
Billy.configure do |c|
feature_name = scenario.feature.name.underscore
scenario_name = scenario.name.underscore
c.cache_path = "features/support/fixtures/req_cache/#{feature_name}/"
Dir.mkdir(Billy.config.cache_path) unless File.exist?(Billy.config.cache_path)
c.cache_path = "features/support/fixtures/req_cache/#{feature_name}/#{scenario_name}/"
end
end
```

## Stub requests recording

If you want to record requests to stubbed URIs, set the following configuration option:
Expand Down Expand Up @@ -478,7 +494,6 @@ end

Note that this approach may cause unexpected behavior if your backend sends the Referer HTTP header (which is unlikely).


## Resources

* [Bring Ruby VCR to Javascript testing with Capybara and puffing-billy](http://architects.dzone.com/articles/bring-ruby-vcr-javascript)
Expand Down

0 comments on commit 9f85277

Please sign in to comment.