Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Fix passing arguments to extension rake (#13513)

Damian Legawiec34f592ce2ce0
diff --git a/core/lib/spree/testing_support/common_rake.rb b/core/lib/spree/testing_support/common_rake.rb
index c4144cd743..d275cfb83a 100644
--- a/core/lib/spree/testing_support/common_rake.rb
+++ b/core/lib/spree/testing_support/common_rake.rb
@@ -3,7 +3,7 @@ require 'generators/spree/dummy_model/dummy_model_generator'
desc 'Generates a dummy app for testing'
namespace :common do
- task :test_app, :user_class do |_t, args|
+ task :test_app, [:authentication, :user_class, :admin_user_class, :css, :javascript, :install_admin, :install_storefront] do |_t, args|
args.with_defaults(
authentication: 'dummy',
user_class: 'Spree::LegacyUser',
diff --git a/core/lib/spree/testing_support/extension_rake.rb b/core/lib/spree/testing_support/extension_rake.rb
index 3ec8cc9380..31304106f1 100644
--- a/core/lib/spree/testing_support/extension_rake.rb
+++ b/core/lib/spree/testing_support/extension_rake.rb
@@ -2,8 +2,21 @@ require 'spree/testing_support/common_rake'
desc 'Generates a dummy app for testing an extension'
namespace :extension do
- task :test_app, [:authentication, :user_class] do |_t, args|
+ task :test_app, [:options] do |_t, args|
Spree::DummyGeneratorHelper.inject_extension_requirements = true
- Rake::Task['common:test_app'].execute(args)
+ # Support both hash passed as first arg and named options
+ options = args[:options].is_a?(Hash) ? args[:options] : args.to_h
+ Rake::Task['common:test_app'].execute(Rake::TaskArguments.new(
+ [:authentication, :user_class, :admin_user_class, :css, :javascript, :install_admin, :install_storefront],
+ [
+ options[:authentication],
+ options[:user_class],
+ options[:admin_user_class],
+ options[:css],
+ options[:javascript],
+ options[:install_admin],
+ options[:install_storefront]
+ ]
+ ))
end
end