forked from OutOfOrder/multidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspec_helper.rb
More file actions
52 lines (40 loc) · 1.18 KB
/
spec_helper.rb
File metadata and controls
52 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
ENV['RACK_ENV'] ||= 'test'
require 'rspec'
require 'yaml'
require 'active_record'
require 'fileutils'
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
require 'multidb'
Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
RSpec.configure do |config|
config.disable_monkey_patching!
config.order = :random
Kernel.srand config.seed
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.filter_run_excluding rails: lambda { |v|
rails_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
test = Gem::Requirement.new(v)
!test.satisfied_by?(rails_version)
}
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.before do
ActiveRecord::Base.connection_handler.clear_all_connections!
Multidb.reset!
end
config.after do
Multidb.reset!
Dir.glob(File.expand_path('test*.sqlite', __dir__)).each do |f|
FileUtils.rm(f)
end
end
end