Skip to content

Commit

Permalink
Add configurable cassette_library_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
MUTOgen committed Dec 29, 2024
1 parent 5afef6a commit 9213daf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ Add your VCR configuration to your `config/cypress_on_rails.rb`
c.vcr_options = {
hook_into: :webmock,
default_cassette_options: { record: :once },
# It's possible to override cassette_library_dir using install_folder
cassette_library_dir: File.expand_path("#{__dir__}/../../spec/cypress/fixtures/vcr_cassettes")
}
```

Expand Down
4 changes: 3 additions & 1 deletion lib/cypress_on_rails/vcr/middleware_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def vcr
end

def cassette_library_dir
"#{configuration.install_folder}/fixtures/vcr_cassettes"
configuration.vcr_options&.fetch(:cassette_library_dir) do
"#{configuration.install_folder}/fixtures/vcr_cassettes"
end
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if defined?(CypressOnRails)
# c.vcr_options = {
# hook_into: :webmock,
# default_cassette_options: { record: :once },
# cassette_library_dir: File.expand_path("#{__dir__}/../../<%= options.install_folder %>/<%= options.framework %>/fixtures/vcr_cassettes")
# }
c.logger = Rails.logger

Expand Down

0 comments on commit 9213daf

Please sign in to comment.