Skip to content

Commit 1191a31

Browse files
committed
Require the cypress on rails dependencies very early in the engine
Since the rails app Gemfile has these configured with require false, we need to do the require early in the engine. config.before_initialize is NOT early enough. config.before_configuration happens before config/application is required. Note, before_initialize didn't work as evidenced by the middlware not processing the requests for /__e2e__/command.
1 parent a803026 commit 1191a31

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

config/initializers/cypress_on_rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# * install_folder (uses our rails engine path)
44
# * require ENV['CYPRESS'] to be set
55
# * requires and instantiates the seeded_deletion strategy
6-
if defined?(CypressOnRails) && ENV['CYPRESS'].present?
6+
if ENV['CYPRESS'].present?
77
CypressOnRails.configure do |c|
88
c.api_prefix = ""
99

lib/manageiq/ui/classic/engine.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ class Engine < ::Rails::Engine
2424
# from which the @import is called over the order set in the SASS load path.
2525
config.assets.paths << root.join('vendor', 'assets', 'stylesheets').to_s
2626

27+
config.before_configuration do
28+
# The rails app Gemfile doesn't require these files so we need to do this very early from this Engine.
29+
if ENV['CYPRESS'].present?
30+
require "cypress-on-rails"
31+
require "database_cleaner"
32+
require "factory_bot_rails"
33+
end
34+
end
35+
2736
if Rails.env.production? || Rails.env.test?
2837
config.assets.configure do |env|
2938
# Workaround rails 7 + es6 syntax in some js causing uglifier errors by running harmony mode

0 commit comments

Comments
 (0)