2015-02-05 20:03:32 -05:00
|
|
|
require_relative 'support/tests/current_bundle'
|
|
|
|
|
|
|
|
Tests::CurrentBundle.instance.assert_appraisal!
|
|
|
|
|
|
|
|
#---
|
|
|
|
|
2014-10-26 20:51:42 -04:00
|
|
|
require File.expand_path('../support/unit/rails_application', __FILE__)
|
2013-10-23 16:18:52 -04:00
|
|
|
|
2014-10-26 20:51:42 -04:00
|
|
|
$test_app = UnitTests::RailsApplication.new
|
2013-11-22 22:25:27 -05:00
|
|
|
$test_app.create
|
|
|
|
$test_app.load
|
2010-12-13 17:28:59 -05:00
|
|
|
|
2013-11-22 22:25:27 -05:00
|
|
|
ENV['BUNDLE_GEMFILE'] ||= app.gemfile_path
|
2013-10-23 16:18:52 -04:00
|
|
|
ENV['RAILS_ENV'] = 'test'
|
2010-12-13 17:28:59 -05:00
|
|
|
|
2012-03-23 21:00:36 -04:00
|
|
|
require 'rspec/rails'
|
2014-12-24 16:28:35 -05:00
|
|
|
require 'shoulda-matchers'
|
2010-12-13 17:28:59 -05:00
|
|
|
|
2013-11-22 22:25:27 -05:00
|
|
|
PROJECT_ROOT = File.expand_path('../..', __FILE__)
|
2010-12-13 17:28:59 -05:00
|
|
|
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
|
|
|
|
|
2014-10-26 20:52:55 -04:00
|
|
|
Dir[ File.join(File.expand_path('../support/unit/**/*.rb', __FILE__)) ].sort.each do |file|
|
2014-10-26 20:51:42 -04:00
|
|
|
require file
|
|
|
|
end
|
|
|
|
|
2010-12-13 17:28:59 -05:00
|
|
|
RSpec.configure do |config|
|
2014-11-06 16:16:30 -05:00
|
|
|
config.order = :random
|
|
|
|
|
2014-01-17 17:01:43 -05:00
|
|
|
config.expect_with :rspec do |c|
|
|
|
|
c.syntax = :expect
|
|
|
|
end
|
|
|
|
|
2015-06-13 09:37:31 -04:00
|
|
|
if config.files_to_run.one?
|
|
|
|
config.default_formatter = 'doc'
|
|
|
|
end
|
|
|
|
|
2014-11-07 17:22:20 -05:00
|
|
|
config.mock_with :rspec
|
|
|
|
|
2014-10-17 14:27:53 -04:00
|
|
|
if config.respond_to?(:infer_spec_type_from_file_location!)
|
|
|
|
config.infer_spec_type_from_file_location!
|
|
|
|
end
|
2014-10-26 20:51:42 -04:00
|
|
|
|
2014-12-24 16:44:38 -05:00
|
|
|
config.before(:all, type: :controller) do
|
|
|
|
self.class.controller(ApplicationController) { }
|
|
|
|
end
|
|
|
|
|
2014-10-26 20:51:42 -04:00
|
|
|
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)
|
2015-01-21 17:46:26 -05:00
|
|
|
UnitTests::ActiveRecordVersions.configure_example_group(config)
|
|
|
|
UnitTests::ActiveModelVersions.configure_example_group(config)
|
2015-02-08 16:38:55 -05:00
|
|
|
UnitTests::DatabaseHelpers.configure_example_group(config)
|
|
|
|
UnitTests::ColumnTypeHelpers.configure_example_group(config)
|
2014-10-26 20:51:42 -04:00
|
|
|
|
|
|
|
config.include UnitTests::Matchers
|
2010-12-13 17:28:59 -05:00
|
|
|
end
|
2014-06-27 18:39:39 -04:00
|
|
|
|
2014-12-24 16:46:10 -05:00
|
|
|
ActiveSupport::Deprecation.behavior = :stderr
|
2014-10-22 20:54:36 -04:00
|
|
|
|
|
|
|
Shoulda::Matchers.configure do |config|
|
|
|
|
config.integrate do |with|
|
|
|
|
with.test_framework :rspec
|
|
|
|
with.library :rails
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-06-27 18:39:39 -04:00
|
|
|
$VERBOSE = true
|