Skip to content

Commit

Permalink
Fix: extension:test_app rake task should detect if Solidus engines …
Browse files Browse the repository at this point in the history
…are available

Acceptance criteria
-------------------

Given a Solidus extension calls `SolidusSupport.x_available?` in its
Install generator to check if the engine is available

When the I run `bundle exec rake extension:test_app`

Then the `SolidusSupport.x_available?` should return true (since the dummy
app installed by `extension:test_app` includes the frontend, backend, and
api engines)

Bug description
---------------

When called within `bundle exec rake extension:test_app`, the install
generator of the extension is not able to detect the Solidus engines
within the dummy app, and as such, returns nil for any
`SolidusSupport.x_available?` call.

Cause
-----

The `<Extension>::Generators::InstallGenerator.start` call within the
`common:test_app` rake task is not able to detect the Solidus engines that
were just installed by the rake task to the spec/dummy directory.

Bug fix
-------

Use the `bin/rails` executable to install the extension on the dummy app.

Possibly related issues
-----------------------

solidusio/solidus_support#66
  • Loading branch information
gsmendoza authored and rmparr committed Jun 1, 2022
1 parent 3ec2b49 commit 58513ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/lib/spree/testing_support/common_rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
sh "bin/rails db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test"

begin
require "generators/#{ENV['LIB_NAME']}/install/install_generator"
generator_namespace = "#{ENV['LIB_NAMESPACE']&.underscore || ENV['LIB_NAME']}"

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

0 comments on commit 58513ed

Please sign in to comment.