Skip to content

Commit 119c91e

Browse files
authored
Merge pull request #222 from mamhoff/allow-passing-user-class-for-test-app
Allow passing a user class to the test app generator
2 parents d02696e + a498d16 commit 119c91e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

lib/solidus_dev_support/rake_tasks.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ module SolidusDevSupport
77
class RakeTasks
88
include Rake::DSL
99

10-
def self.install(*args)
11-
new(*args).tap(&:install)
10+
def self.install(**args)
11+
new(**args).tap(&:install)
1212
end
1313

14-
def initialize(root: Dir.pwd)
14+
def initialize(root: Dir.pwd, user_class: "Spree::LegacyUser")
1515
@root = Pathname(root)
1616
@test_app_path = @root.join(ENV.fetch('DUMMY_PATH', 'spec/dummy'))
1717
@gemspec = Bundler.load_gemspec(@root.glob("{,*}.gemspec").first)
18+
@user_class = user_class
1819
end
1920

2021
attr_reader :test_app_path, :root, :gemspec
@@ -39,12 +40,12 @@ def install_test_app_task
3940
# We need to go back to the gem root since the upstream
4041
# extension:test_app changes the working directory to be the dummy app.
4142
task :test_app do
42-
Rake::Task['extension:test_app'].invoke
43+
Rake::Task['extension:test_app'].invoke(@user_class)
4344
cd root
4445
end
4546

4647
directory ENV.fetch('DUMMY_PATH', nil) do
47-
Rake::Task['extension:test_app'].invoke
48+
Rake::Task['extension:test_app'].invoke(@user_class)
4849
end
4950
end
5051
end

lib/solidus_dev_support/templates/extension/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
require "bundler/gem_tasks"
44
require 'solidus_dev_support/rake_tasks'
5-
SolidusDevSupport::RakeTasks.install
5+
SolidusDevSupport::RakeTasks.install(user_class: "Spree::User")
66

77
task default: 'extension:specs'

0 commit comments

Comments
 (0)