Skip to content

Commit a3bc5e9

Browse files
committed
Configure mongoid inline
1 parent 7221105 commit a3bc5e9

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

spec/spec_helper.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,21 @@
4545

4646
Dir["#{File.dirname(__FILE__)}/support/*.rb"].each { |file| require file }
4747

48-
Mongoid.load!('spec/support/mongoid.yml')
48+
mongo_db_name = (ENV['MONGODB_DATABASE'] || '_ms_rails_test') + SecureRandom.hex(8)
49+
Mongoid.load_configuration(
50+
{
51+
clients: {
52+
default: {
53+
database: mongo_db_name,
54+
hosts: [ENV['MONGODB_HOST'] || 'localhost:27017'],
55+
options: {
56+
read: { mode: :primary },
57+
max_pool_size: 1
58+
}
59+
}
60+
}
61+
}
62+
)
4963

5064
RSpec.configure do |c|
5165
c.mock_with :rspec

spec/support/mongoid.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)