diff options
author | Jared Norman <jared@super.gd> | 2020-06-24 11:52:01 -0700 |
---|---|---|
committer | Jared Norman <jared@super.gd> | 2020-06-24 11:52:01 -0700 |
commit | 96a435b27fd7a4e7e26299aeacf95746d594da15 (patch) | |
tree | 079721a6096d5324ae67c8d813c7bc24e4856c62 | |
parent | dc52d0cec7f349d02f3fbd6f2ade0a113331d4d4 (diff) |
Clean up spec setup as per solidus_dev_support
-rw-r--r-- | spec/spec_helper.rb | 46 | ||||
-rw-r--r-- | super_good-solidus_taxjar.gemspec | 1 |
2 files changed, 14 insertions, 33 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d79d49a..e55b5c5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,38 +1,20 @@ -ENV['RAILS_ENV'] ||= 'test' +# frozen_string_literal: true -require "bundler/setup" -require "database_cleaner" +# Configure Rails Environment +ENV['RAILS_ENV'] = 'test' -begin - require File.expand_path('../dummy/config/environment', __FILE__) -rescue LoadError - puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`' - exit -end - -RSpec.configure do |config| - config.expect_with :rspec do |c| - c.syntax = :expect - end +require File.expand_path('dummy/config/environment.rb', __dir__).tap { |file| + # Create the dummy app if it's still missing. + system 'bin/rake extension:test_app' unless File.exist? file +} - config.disable_monkey_patching! - config.filter_run :focus - config.run_all_when_everything_filtered = true - config.default_formatter = 'doc' if config.files_to_run.one? +require 'solidus_dev_support/rspec/rails_helper' - config.order = "random" - Kernel.srand config.seed +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f } - config.before :suite do - DatabaseCleaner.strategy = :transaction - end - - config.before :each do - DatabaseCleaner.start - end - - # After each spec clean the database. - config.after :each do - DatabaseCleaner.clean - end +RSpec.configure do |config| + config.infer_spec_type_from_file_location! + config.use_transactional_fixtures = false end diff --git a/super_good-solidus_taxjar.gemspec b/super_good-solidus_taxjar.gemspec index b22c2ff..d54cd91 100644 --- a/super_good-solidus_taxjar.gemspec +++ b/super_good-solidus_taxjar.gemspec @@ -31,7 +31,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "solidus_dev_support" spec.add_development_dependency "bundler" - spec.add_development_dependency "database_cleaner" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec-rails" |