spec/spec_helper.rb in solidus_newsletter-1.0 vs spec/spec_helper.rb in solidus_newsletter-1.1

- old
+ new

@@ -1,45 +1,31 @@ -require 'simplecov' -SimpleCov.start do - add_filter 'spec' - add_group 'Controllers', 'app/controllers' - add_group 'Helpers', 'app/helpers' - add_group 'Overrides', 'app/overrides' - add_group 'Models', 'app/models' -end +# frozen_string_literal: true -ENV['RAILS_ENV'] ||= 'test' +# Configure Rails Environment +ENV['RAILS_ENV'] = 'test' -require File.expand_path('../dummy/config/environment.rb', __FILE__) +# Run Coverage report +require 'solidus_dev_support/rspec/coverage' -require 'solidus_frontend' -require 'solidus_backend' -require 'rspec/rails' +# Create the dummy app if it's still missing. +dummy_env = "#{__dir__}/dummy/config/environment.rb" +system 'bin/rake extension:test_app' unless File.exist? dummy_env +require dummy_env -Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |file| require file } +# Requires factories and other useful helpers defined in spree_core. +require 'solidus_dev_support/rspec/feature_helper' -require 'spree/testing_support/url_helpers' -require 'spree/testing_support/controller_requests' -require 'spree/testing_support/authorization_helpers' -require 'spree/testing_support/preferences' -require 'spree/testing_support/factories' -require 'spree/api/testing_support/helpers' -require 'spree/api/testing_support/setup' +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } -# Requires factories defined in lib/solidus_newsletter/factories.rb -require 'solidus_newsletter/factories' +# Requires factories defined in lib/solidus_related_products/testing_support/factories.rb +SolidusDevSupport::TestingSupport::Factories.load_for(SolidusNewsletter::Engine) RSpec.configure do |config| config.infer_spec_type_from_file_location! - config.infer_base_class_for_anonymous_controllers = false - config.infer_spec_type_from_file_location! - config.use_transactional_fixtures = true + config.use_transactional_fixtures = false - config.include FactoryBot::Syntax::Methods - config.include Spree::Api::TestingSupport::Helpers, type: :controller - config.extend Spree::Api::TestingSupport::Setup, type: :controller - config.include Spree::TestingSupport::ControllerRequests, type: :controller - config.include Spree::TestingSupport::UrlHelpers - config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :request - config.include Spree::TestingSupport::Preferences, type: :controller - config.include Spree::TestingSupport::Preferences, type: :model + if Spree.solidus_gem_version < Gem::Version.new('2.11') + config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system + end end