Skip to content

Commit

Permalink
Skip eager loading during dummy app generation
Browse files Browse the repository at this point in the history
Pageflow cannot be eager loaded while it has not been configured
yet. Once the initializer has been generated, we can test eager
loading as part of the main test suite.

REDMINE-20487
  • Loading branch information
tf committed Nov 14, 2023
1 parent 3d4122c commit 4ecab98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spec/support/pageflow/dummy/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def generate
if File.exist?(directory)
puts("Dummy directory #{directory} exists.")
else
system("bundle exec rails new #{directory} --skip-spring " \
system('SKIP_EAGER_LOAD=true ' \
"bundle exec rails new #{directory} --skip-spring " \
"--template #{template_path} #{rails_new_options}") ||
raise('Error generating dummy app.')
end
Expand Down
4 changes: 4 additions & 0 deletions spec/support/pageflow/dummy/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def source_paths
/^ database: /,
" database: #{database_prefix}-")

gsub_file('config/environments/test.rb',
'config.eager_load = ENV["CI"].present?',
'config.eager_load = ENV["CI"].present? && !ENV["SKIP_EAGER_LOAD"]')

append_to_file('config/application.rb', <<-END)
if ENV['PAGEFLOW_DB_HOST'].present?
ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS << ENV['PAGEFLOW_DB_HOST']
Expand Down

0 comments on commit 4ecab98

Please sign in to comment.