spec/spec_helper.rb in curate-0.0.1 vs spec/spec_helper.rb in curate-0.1.0

- old
+ new

@@ -1,15 +1,68 @@ # Configure Rails Environment -ENV["RAILS_ENV"] = "test" +ENV["RAILS_ENV"] ||= 'test' +if ENV['COVERAGE'] + require 'simplecov' + SimpleCov.start 'rails' + SimpleCov.command_name "spec" +end + require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" +require 'rspec/rails' +require 'webmock/rspec' +require 'rspec-html-matchers' +require 'rspec/autorun' +require 'database_cleaner' +require 'factory_girl' +Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require f } + + Rails.backtrace_cleaner.remove_silencers! # Load support files Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } # Load fixtures from the engine if ActiveSupport::TestCase.method_defined?(:fixture_path=) ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__) +end + +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# Require this file using `require "spec_helper"` to ensure that it is only +# loaded once. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + config.treat_symbols_as_metadata_keys_with_true_values = true + config.run_all_when_everything_filtered = true + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = 'random' + + config.include Devise::TestHelpers, type: :controller + + config.use_transactional_fixtures = false + + config.before(:all) do + WebMock.allow_net_connect! + end + + config.before(:suite) do + DatabaseCleaner.strategy = :truncation + DatabaseCleaner.clean_with(:truncation) + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end end