Sha256: 2d5bbdde5888191f956deccd00d61270ac8a9ce7fc9e7516518590ad174ed27e

Contents?: true

Size: 1.71 KB

Versions: 7

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

# A basic rails_helper to be included as the starting point for extensions
#
# Can be required from an extension's spec/rails_helper.rb
#
#     require 'solidus_dev_support/rspec/rails_helper'
#

require 'solidus_dev_support/rspec/spec_helper'
require 'solidus_dev_support'

require 'rspec/rails'
require 'database_cleaner'
require 'factory_bot_rails'
require 'ffaker'

require 'spree/testing_support/authorization_helpers'
require 'spree/testing_support/factories'
require 'spree/testing_support/url_helpers'
require 'spree/testing_support/preferences'
require 'spree/testing_support/controller_requests'
require 'solidus_dev_support/testing_support/preferences'

RSpec.configure do |config|
  config.infer_spec_type_from_file_location!

  config.include FactoryBot::Syntax::Methods

  # visit spree.admin_path
  # current_path.should eql(spree.products_path)
  config.include Spree::TestingSupport::UrlHelpers

  config.include Spree::TestingSupport::ControllerRequests, type: :controller

  config.include Spree::TestingSupport::Preferences
  config.include SolidusDevSupport::TestingSupport::Preferences

  config.before :suite do
    DatabaseCleaner.clean_with :truncation
  end

  config.before do
    ActiveJob::Base.queue_adapter = :test
  end

  # Around each spec check if it is a Javascript test and switch between using
  # database transactions or not where necessary.
  config.around(:each) do |example|
    DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction

    DatabaseCleaner.cleaning do
      reset_spree_preferences unless SolidusDevSupport.reset_spree_preferences_deprecated?

      example.run
    end
  end

  config.include ActiveJob::TestHelper
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_dev_support-1.0.0 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.6.0 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.5.0 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.4.1 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.4.0 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.3.0 lib/solidus_dev_support/rspec/rails_helper.rb
solidus_dev_support-0.2.0 lib/solidus_dev_support/rspec/rails_helper.rb