2019-02-04 21:33:22 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-06 15:07:05 +08:00
|
|
|
require 'capybara/rspec'
|
|
|
|
require 'simplecov'
|
2017-07-10 20:38:18 +08:00
|
|
|
require 'faker'
|
2017-08-30 22:18:21 +08:00
|
|
|
require 'active_record'
|
|
|
|
require 'bullet'
|
2019-02-04 21:33:22 +08:00
|
|
|
require 'json_matchers/rspec'
|
|
|
|
require 'webmock/rspec'
|
2017-07-06 15:07:05 +08:00
|
|
|
|
2018-04-22 17:35:37 +08:00
|
|
|
# Require all custom matchers
|
2019-02-04 21:33:22 +08:00
|
|
|
Dir[
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb'))
|
|
|
|
].each { |f| require f }
|
2018-04-22 17:35:37 +08:00
|
|
|
|
2017-07-06 15:07:05 +08:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.expect_with :rspec do |expectations|
|
|
|
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
|
|
end
|
|
|
|
|
|
|
|
# rspec-mocks config goes here. You can use an alternate test double
|
|
|
|
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
|
|
config.mock_with :rspec do |mocks|
|
|
|
|
# Prevents you from mocking or stubbing a method that does not exist on
|
|
|
|
# a real object. This is generally recommended, and will default to
|
|
|
|
# `true` in RSpec 4.
|
|
|
|
mocks.verify_partial_doubles = true
|
|
|
|
end
|
|
|
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
|
|
|
2017-08-30 22:18:21 +08:00
|
|
|
if Bullet.enable?
|
|
|
|
config.before(:each) do
|
|
|
|
Bullet.start_request
|
|
|
|
end
|
|
|
|
|
|
|
|
config.after(:each) do
|
|
|
|
Bullet.perform_out_of_channel_notifications if Bullet.notification?
|
|
|
|
Bullet.end_request
|
|
|
|
end
|
|
|
|
end
|
2017-07-06 15:07:05 +08:00
|
|
|
end
|