Sha256: 0879ea27aa8ec525d109e0d5ec442bea57dfea8633e9d501a6e7d6dae40eba4b

Contents?: true

Size: 1.29 KB

Versions: 38

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

unless defined?(Solidus::InstallGenerator)
  require 'generators/solidus/install/install_generator'
end

require 'generators/spree/dummy/dummy_generator'

namespace :common do
  task :test_app, :user_class do |_t, args|
    args.with_defaults(user_class: "Spree::LegacyUser")
    require ENV['LIB_NAME']

    ENV["RAILS_ENV"] = '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"

    begin
      require "generators/#{ENV['LIB_NAME']}/install/install_generator"
      puts 'Running extension installation generator...'
      "#{ENV['LIB_NAMESPACE'] || ENV['LIB_NAME'].camelize}::Generators::InstallGenerator".constantize.start(["--auto-run-migrations"])
    rescue LoadError
      # No extension generator to run
    end
  end

  task :seed do |_t, _args|
    puts "Seeding ..."

    sh "bundle exec rake db:seed RAILS_ENV=test"
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
solidus_core-3.1.9 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.8 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.8 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.7 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.17 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.7 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.16 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.6 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.6 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.15 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.14 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.5 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.5 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.13 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.4 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.4 lib/spree/testing_support/common_rake.rb
solidus_core-2.11.12 lib/spree/testing_support/common_rake.rb
solidus_core-3.0.3 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.3 lib/spree/testing_support/common_rake.rb
solidus_core-3.1.2 lib/spree/testing_support/common_rake.rb