Skip to content

Commit

Permalink
Updated factories loading after recent changes in solidus
Browse files Browse the repository at this point in the history
This commit reflects changes made by Solidus [PR #169]
(solidusio/solidus_dev_support#169 (comment)) When testing extensions
using Solidus vesions that support the definition_file_paths,
it will load the core factory first and then the ones defined in
`lib/extension_name/testing_support/factories`.
Additionally, this extention makes use of assertions
(i.e. `assert_nothing_raised) found in the version of Rails not used by
Solidus 2.10, therefore it must be manually configured in `Rspec.config`.
  • Loading branch information
cpfergus1 committed Jun 9, 2021
1 parent f83c2d9 commit c2c7c41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/solidus_expedited_exchanges/testing_support/factories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

FactoryBot.define do
end
6 changes: 4 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }

# Requires factories defined in lib/solidus_expedited_exchanges/factories.rb
require 'solidus_expedited_exchanges/factories'
# Will load Solidus core factory first and then the ones
# defined in `lib/solidus_expedited_exchanges/testing_support/factories.rb`.
# and `lib/solidus_expedited_exchanges/testing_support/factories`.
SolidusDevSupport::TestingSupport::Factories.load_for(SolidusExpeditedExchanges::Engine)

RSpec.configure do |config|
config.include(ActiveSupport::Testing::Assertions)
Expand Down

0 comments on commit c2c7c41

Please sign in to comment.