Skip to content

Commit

Permalink
Fixes isse when zeitwerk is not enabled
Browse files Browse the repository at this point in the history
If autoloaders is defined in the Rails object, but the
autoloader zeitwerk is not used, it is defined but returns
nil when calling `main`, this ensures the extra check.
  • Loading branch information
softr8 committed Jan 2, 2020
1 parent 7f544b6 commit 8f05db6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gem 'solidus_core', github: 'solidusio/solidus', branch: branch
# Specify your gem's dependencies in solidus_support.gemspec
gemspec

gem 'solidus_extension_dev_tools', github: 'solidusio-contrib/solidus_extension_dev_tools'
gem 'solidus_dev_support', github: 'solidusio-contrib/solidus_dev_support'
gem 'sprockets', '~> 3'
gem 'sprockets-rails'

Expand Down
2 changes: 1 addition & 1 deletion lib/solidus_support/engine_extensions/decorators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module ClassMethods
def activate
base_path = root.join('app/decorators')

if Rails.respond_to?(:autoloaders)
if Rails.respond_to?(:autoloaders) && Rails.autoloaders.main
# Add decorators folder to the Rails autoloader. This
# allows Zeitwerk to resolve decorators paths correctly,
# when used.
Expand Down
2 changes: 1 addition & 1 deletion solidus_support.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'solidus_core'
spec.add_development_dependency 'solidus_extension_dev_tools'
spec.add_development_dependency 'solidus_dev_support'
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

require_relative 'support/dummy_app'
require 'solidus_extension_dev_tools/rspec/spec_helper'
require 'solidus_dev_support/rspec/spec_helper'

0 comments on commit 8f05db6

Please sign in to comment.