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 committed Mar 16, 2022
1 parent d996288 commit 2b33feb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/spree/testing_support/common_rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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"])
sh "bin/rails generate #{ENV['LIB_NAMESPACE']&.underscore || ENV['LIB_NAME']}:install --auto-run-migrations"
rescue LoadError
# No extension generator to run
end
Expand Down

0 comments on commit 2b33feb

Please sign in to comment.