2016-09-13 17:45:13 +05:30
|
|
|
require './spec/simplecov_env'
|
|
|
|
SimpleCovEnv.start!
|
2014-09-02 18:07:02 +05:30
|
|
|
|
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'
|
2016-06-02 11:05:42 +05:30
|
|
|
require 'rspec/retry'
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
if ENV['CI']
|
|
|
|
require 'knapsack'
|
|
|
|
Knapsack::Adapters::RSpecAdapter.bind
|
|
|
|
end
|
|
|
|
|
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
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
config.verbose_retry = true
|
|
|
|
config.display_try_failure_messages = true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
2016-06-02 11:05:42 +05:30
|
|
|
config.include EmailHelpers
|
2014-09-02 18:07:02 +05:30
|
|
|
config.include TestEnv
|
2015-12-23 02:04:40 +05:30
|
|
|
config.include ActiveJob::TestHelper
|
2016-09-13 17:45:13 +05:30
|
|
|
config.include ActiveSupport::Testing::TimeHelpers
|
2015-09-25 12:07:36 +05:30
|
|
|
config.include StubGitlabCalls
|
|
|
|
config.include StubGitlabData
|
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
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
config.around(:each, :caching) do |example|
|
|
|
|
caching_store = Rails.cache
|
|
|
|
Rails.cache = ActiveSupport::Cache::MemoryStore.new if example.metadata[:caching]
|
|
|
|
example.run
|
|
|
|
Rails.cache = caching_store
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
ActiveRecord::Migration.maintain_test_schema!
|