1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/spec/unit_spec_helper.rb
Mauro George c14f344e3e Run formatter documentation when running a single file
Today if we run a single file or spec like `callback_matcher_spec.rb` or
`callback_matcher_spec.rb:12` the formatter is the default dot.

With this config when we run a single file or spec the formatter is the
documentation and when we run the suite the formatter is the default dot.
2015-06-13 10:37:31 -03:00

73 lines
2 KiB
Ruby

require_relative 'support/tests/current_bundle'
Tests::CurrentBundle.instance.assert_appraisal!
#---
require File.expand_path('../support/unit/rails_application', __FILE__)
$test_app = UnitTests::RailsApplication.new
$test_app.create
$test_app.load
ENV['BUNDLE_GEMFILE'] ||= app.gemfile_path
ENV['RAILS_ENV'] = 'test'
require 'rspec/rails'
require 'shoulda-matchers'
PROJECT_ROOT = File.expand_path('../..', __FILE__)
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
Dir[ File.join(File.expand_path('../support/unit/**/*.rb', __FILE__)) ].sort.each do |file|
require file
end
RSpec.configure do |config|
config.order = :random
config.expect_with :rspec do |c|
c.syntax = :expect
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.mock_with :rspec
if config.respond_to?(:infer_spec_type_from_file_location!)
config.infer_spec_type_from_file_location!
end
config.before(:all, type: :controller) do
self.class.controller(ApplicationController) { }
end
UnitTests::ActiveModelHelpers.configure_example_group(config)
UnitTests::ActiveModelVersions.configure_example_group(config)
UnitTests::ActiveResourceBuilder.configure_example_group(config)
UnitTests::ClassBuilder.configure_example_group(config)
UnitTests::ControllerBuilder.configure_example_group(config)
UnitTests::I18nFaker.configure_example_group(config)
UnitTests::MailerBuilder.configure_example_group(config)
UnitTests::ModelBuilder.configure_example_group(config)
UnitTests::RailsVersions.configure_example_group(config)
UnitTests::ActiveRecordVersions.configure_example_group(config)
UnitTests::ActiveModelVersions.configure_example_group(config)
UnitTests::DatabaseHelpers.configure_example_group(config)
UnitTests::ColumnTypeHelpers.configure_example_group(config)
config.include UnitTests::Matchers
end
ActiveSupport::Deprecation.behavior = :stderr
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
$VERBOSE = true