# Requires factories and other useful helpers defined in spree_core. require 'spree/testing_support/authorization_helpers' require 'spree/testing_support/capybara_ext' require 'spree/testing_support/factories' require 'spree/testing_support/preferences' require 'spree/testing_support/controller_requests' require 'spree/testing_support/flash' require 'spree/testing_support/url_helpers' require 'spree/testing_support/order_walkthrough' require 'spree/testing_support/auth_helpers' require 'spree/testing_support/checkout_helpers' require 'spree/testing_support/caching' # API helpers if defined?(Spree::Api) require 'spree/api/testing_support/helpers' end # API v2 helpers if defined?(Spree::Api) && Spree.version.to_f >= 3.7 require 'jsonapi/rspec' require 'spree/api/testing_support/v2/base' require 'spree/api/testing_support/v2/current_order' end RSpec.configure do |config| # Infer an example group's spec type from the file location. config.infer_spec_type_from_file_location! # == URL Helpers # # Allows access to Spree's routes in specs: # # visit spree.admin_path # current_path.should eql(spree.products_path) config.include Spree::TestingSupport::UrlHelpers # == Requests support # # Adds convenient methods to request Spree's controllers # spree_get :index config.include Spree::TestingSupport::ControllerRequests, type: :controller config.include Spree::TestingSupport::Preferences config.include Spree::TestingSupport::Flash config.include Spree::TestingSupport::AuthHelpers, type: :feature config.include Spree::TestingSupport::CheckoutHelpers, type: :feature if defined?(Spree::Api) config.include Spree::Api::TestingSupport::Helpers # needed for API v1 end if Spree.version.to_f >= 3.7 config.include JSONAPI::RSpec, type: :request # required for API v2 request specs end config.before :each do Rails.cache.clear reset_spree_preferences do |config| # config.my_custom_preference = 10 end create(:store) end end