Skip to content

Commit 71d0ed7

Browse files
justin808claude
andcommitted
Fix generator to create correct folder structure for install
The generator was creating e2e_helper.rb and app_commands inside the framework subdirectory (e.g., e2e/cypress/app_commands), but they should be at the install_folder root level (e.g., e2e/app_commands). Changes: - Move e2e_helper.rb from install_folder/framework/ to install_folder/ - Move app_commands/ from install_folder/framework/ to install_folder/ - Update initializer template to set install_folder without framework path - Update VCR cassette path to use install_folder directly This ensures: 1. Cypress/Playwright can find their config files via --project flag 2. Middleware can find e2e_helper.rb and app_commands at install_folder 3. Both frameworks can share the same helper and commands if needed Fixes #201 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent abb505c commit 71d0ed7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/generators/cypress_on_rails/install_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def install_framework
4242

4343
def add_initial_files
4444
template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb"
45-
template "spec/e2e/e2e_helper.rb.erb", "#{options.install_folder}/#{options.framework}/e2e_helper.rb"
46-
directory 'spec/e2e/app_commands', "#{options.install_folder}/#{options.framework}/app_commands"
45+
template "spec/e2e/e2e_helper.rb.erb", "#{options.install_folder}/e2e_helper.rb"
46+
directory 'spec/e2e/app_commands', "#{options.install_folder}/app_commands"
4747
if options.framework == 'cypress'
4848
copy_file "spec/cypress/support/on-rails.js", "#{options.install_folder}/cypress/support/on-rails.js"
4949
directory 'spec/cypress/e2e/rails_examples', "#{options.install_folder}/cypress/e2e/rails_examples"

lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
if defined?(CypressOnRails)
22
CypressOnRails.configure do |c|
33
c.api_prefix = "<%= options.api_prefix %>"
4-
c.install_folder = File.expand_path("#{__dir__}/../../<%= options.install_folder %>/<%= options.framework %>")
4+
c.install_folder = File.expand_path("#{__dir__}/../../<%= options.install_folder %>")
55
# WARNING!! CypressOnRails can execute arbitrary ruby code
66
# please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
77
c.use_middleware = !Rails.env.production?
@@ -12,7 +12,7 @@ if defined?(CypressOnRails)
1212
<% unless options.experimental %># <% end %> c.vcr_options = {
1313
<% unless options.experimental %># <% end %> hook_into: :webmock,
1414
<% unless options.experimental %># <% end %> default_cassette_options: { record: :once },
15-
<% unless options.experimental %># <% end %> cassette_library_dir: File.expand_path("#{__dir__}/../../<%= options.install_folder %>/<%= options.framework %>/fixtures/vcr_cassettes")
15+
<% unless options.experimental %># <% end %> cassette_library_dir: File.expand_path("#{__dir__}/../../<%= options.install_folder %>/fixtures/vcr_cassettes")
1616
<% unless options.experimental %># <% end %> }
1717
c.logger = Rails.logger
1818

0 commit comments

Comments
 (0)