Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Ability to skip migrations when creating a test app (#12979)
Damian Legawiec3e9fc52f05c5
diff --git a/core/lib/spree/testing_support/common_rake.rb b/core/lib/spree/testing_support/common_rake.rbindex 9da4c7b8c5..8271e5e1f9 100644--- a/core/lib/spree/testing_support/common_rake.rb+++ b/core/lib/spree/testing_support/common_rake.rb@@ -52,21 +52,39 @@ namespace :common do"--authentication=#{args[:authentication]}"]- puts 'Setting up dummy database...'- system('bin/rails db:environment:set RAILS_ENV=test > /dev/null 2>&1')- system('bundle exec rake db:drop db:create > /dev/null 2>&1')- Spree::DummyModelGenerator.start- system('bundle exec rake db:migrate > /dev/null 2>&1')+ if !skip_javascript || ENV['LIB_NAME'] == 'spree/emails'+ puts 'Precompiling assets...'+ system('bundle exec rake assets:precompile > /dev/null 2>&1')+ end++ unless ENV['NO_MIGRATE']+ puts 'Setting up dummy database...'+ system('bin/rails db:environment:set RAILS_ENV=test > /dev/null 2>&1')+ system('bundle exec rake db:drop db:create > /dev/null 2>&1')+ Spree::DummyModelGenerator.start+ system('bundle exec rake db:migrate > /dev/null 2>&1')+ endbeginrequire "generators/#{ENV['LIB_NAME']}/install/install_generator"puts 'Running extension installation generator...'- "#{ENV['LIB_NAME'].camelize}::Generators::InstallGenerator".constantize.start(['--auto-run-migrations'])++ if ENV['NO_MIGRATE']+ "#{ENV['LIB_NAME'].camelize}::Generators::InstallGenerator".constantize.start([])+ else+ "#{ENV['LIB_NAME'].camelize}::Generators::InstallGenerator".constantize.start(['--auto-run-migrations'])+ endrescue LoadErrorputs 'Skipping installation no generator to run...'end+ end- system('bundle exec rake assets:precompile > /dev/null 2>&1') if !skip_javascript || ENV['LIB_NAME'] == 'spree/emails'+ task :db_setup do |_t|+ puts 'Setting up dummy database...'+ system('bin/rails db:environment:set RAILS_ENV=test > /dev/null 2>&1')+ system('bundle exec rake db:drop db:create > /dev/null 2>&1')+ Spree::DummyModelGenerator.start+ system('bundle exec rake db:migrate > /dev/null 2>&1')endtask :seed do |_t|