-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only require the necessary Rails frameworks
By requiring rails/all Solidus was loading a bunch of unnecessary code taking more time and consuming more memory. This change allows apps that want to cherry-pick Rails frameworks to benefit from the more attentive choice.
- Loading branch information
1 parent
ee05883
commit 1237e6a
Showing
7 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'spree/backend' | ||
|
||
RSpec.describe Spree::Backend do | ||
it 'loads only the necessary Rails Frameworks' do | ||
aggregate_failures do | ||
expect(defined? ActionCable::Engine).to be_falsey | ||
expect(defined? ActionController::Railtie).to be_truthy | ||
expect(defined? ActionMailer::Railtie).to be_truthy | ||
expect(defined? ActionView::Railtie).to be_truthy | ||
expect(defined? ActiveJob::Railtie).to be_truthy | ||
expect(defined? ActiveModel::Railtie).to be_truthy | ||
expect(defined? ActiveRecord::Railtie).to be_truthy | ||
expect(defined? ActiveStorage::Engine).to be_falsey | ||
expect(defined? Rails::TestUnit::Railtie).to be_falsey | ||
expect(defined? Sprockets::Railtie).to be_truthy | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'spree/core' | ||
|
||
RSpec.describe Spree::Core do | ||
it 'loads only the necessary Rails Frameworks' do | ||
aggregate_failures do | ||
expect(defined? ActionCable::Engine).to be_falsey | ||
expect(defined? ActionController::Railtie).to be_truthy | ||
expect(defined? ActionMailer::Railtie).to be_truthy | ||
expect(defined? ActionView::Railtie).to be_truthy | ||
expect(defined? ActiveJob::Railtie).to be_truthy | ||
expect(defined? ActiveModel::Railtie).to be_truthy | ||
expect(defined? ActiveRecord::Railtie).to be_truthy | ||
expect(defined? ActiveStorage::Engine).to be_truthy | ||
expect(defined? Rails::TestUnit::Railtie).to be_falsey | ||
expect(defined? Sprockets::Railtie).to be_truthy | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'spree/frontend' | ||
|
||
RSpec.describe Spree::Frontend do | ||
it 'loads only the necessary Rails Frameworks' do | ||
aggregate_failures do | ||
expect(defined? ActionCable::Engine).to be_falsey | ||
expect(defined? ActionController::Railtie).to be_truthy | ||
expect(defined? ActionMailer::Railtie).to be_truthy | ||
expect(defined? ActionView::Railtie).to be_truthy | ||
expect(defined? ActiveJob::Railtie).to be_truthy | ||
expect(defined? ActiveModel::Railtie).to be_truthy | ||
expect(defined? ActiveRecord::Railtie).to be_truthy | ||
expect(defined? ActiveStorage::Engine).to be_falsey | ||
expect(defined? Rails::TestUnit::Railtie).to be_falsey | ||
expect(defined? Sprockets::Railtie).to be_truthy | ||
end | ||
end | ||
end |