Module: DummyApp

Defined in:
lib/spree/testing_support/dummy_app.rb,
lib/spree/testing_support/dummy_app/migrations.rb,
lib/spree/testing_support/dummy_app/rake_tasks.rb

Defined Under Namespace

Modules: Migrations Classes: Application, RakeTasks

Class Method Summary collapse

Class Method Details

.setup(gem_root:, lib_name:, auto_migrate: true) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/spree/testing_support/dummy_app.rb', line 36

def self.setup(gem_root:, lib_name:, auto_migrate: true)
  ENV["LIB_NAME"] = lib_name
  root = Pathname(gem_root).join('spec/dummy')
  root.join("app/assets/config").mkpath
  root.join("app/assets/config/manifest.js").write("// Intentionally empty\n")

  DummyApp::Application.config.root = root
  DummyApp::Application.initialize! unless DummyApp::Application.initialized?

  # Raise on deprecation warnings.
  # NOTE: This needs to happen after the application is initialized.
  if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
    Spree.deprecator.behavior = :raise
  end

  if auto_migrate
    DummyApp::Migrations.auto_migrate
  end
end