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