Class: CommonRakeTasks
- Inherits:
-
Object
- Object
- CommonRakeTasks
- Includes:
- Rake::DSL
- Defined in:
- lib/spree/testing_support/common_rake.rb
Instance Method Summary collapse
-
#initialize ⇒ CommonRakeTasks
constructor
A new instance of CommonRakeTasks.
Constructor Details
#initialize ⇒ CommonRakeTasks
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/spree/testing_support/common_rake.rb', line 12 def initialize namespace :common do task :test_app, :user_class do |_t, args| args.with_defaults(user_class: "Spree::LegacyUser") require ENV['LIB_NAME'] force_rails_environment_to_test Spree::DummyGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--quiet"] Solidus::InstallGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--auto-accept", "--with-authentication=false", "--payment-method=none", "--migrate=false", "--seed=false", "--sample=false", "--quiet", "--user_class=#{args[:user_class]}"] puts "Setting up dummy database..." sh "bin/rails db:environment:set RAILS_ENV=test" sh "bin/rails db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test" if extension_installation_generator_exists? puts 'Running extension installation generator...' sh "bin/rails generate #{rake_generator_namespace}:install --auto-run-migrations" end end task :seed do |_t, _args| puts "Seeding ..." sh "bundle exec rake db:seed RAILS_ENV=test" end end end |