debian-mirror-gitlab/spec/spec_helper.rb

58 lines
1.5 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
if ENV['SIMPLECOV']
require 'simplecov'
2015-09-11 14:41:01 +05:30
SimpleCov.start :rails
2015-04-26 12:48:37 +05:30
end
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
if ENV['COVERALLS']
2014-09-02 18:07:02 +05:30
require 'coveralls'
2015-04-26 12:48:37 +05:30
Coveralls.wear_merged!
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
ENV["RAILS_ENV"] ||= 'test'
2015-09-11 14:41:01 +05:30
2015-04-26 12:48:37 +05:30
require File.expand_path("../../config/environment", __FILE__)
2014-09-02 18:07:02 +05:30
require 'rspec/rails'
2015-09-11 14:41:01 +05:30
require 'shoulda/matchers'
2014-09-02 18:07:02 +05:30
require 'sidekiq/testing/inline'
2015-10-24 18:46:33 +05:30
require 'benchmark/ips'
2014-09-02 18:07:02 +05:30
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
2015-09-11 14:41:01 +05:30
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
2014-09-02 18:07:02 +05:30
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.use_instantiated_fixtures = false
config.mock_with :rspec
config.include Devise::TestHelpers, type: :controller
2015-09-11 14:41:01 +05:30
config.include LoginHelpers, type: :feature
config.include LoginHelpers, type: :request
config.include StubConfiguration
2015-09-25 12:07:36 +05:30
config.include RelativeUrl, type: feature
2014-09-02 18:07:02 +05:30
config.include TestEnv
2015-12-23 02:04:40 +05:30
config.include ActiveJob::TestHelper
2015-09-25 12:07:36 +05:30
config.include StubGitlabCalls
config.include StubGitlabData
2015-10-24 18:46:33 +05:30
config.include BenchmarkMatchers, benchmark: true
2015-09-11 14:41:01 +05:30
2015-04-26 12:48:37 +05:30
config.infer_spec_type_from_file_location!
config.raise_errors_for_deprecations!
2014-09-02 18:07:02 +05:30
config.before(:suite) do
TestEnv.init
end
end
2015-04-26 12:48:37 +05:30
2015-10-24 18:46:33 +05:30
FactoryGirl::SyntaxRunner.class_eval do
include RSpec::Mocks::ExampleMethods
end
2016-02-05 20:25:01 +05:30
# Work around a Rails 4.2.5.1 issue
# See https://github.com/rspec/rspec-rails/issues/1532
RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator.class_eval do
alias_method :find_all_anywhere, :find_all
end
2015-04-26 12:48:37 +05:30
ActiveRecord::Migration.maintain_test_schema!