-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathmongoid_test.rb
39 lines (35 loc) · 871 Bytes
/
mongoid_test.rb
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
require_relative "test_helper"
class MongoidTest < Minitest::Test
def test_connect
Mongoid.load_configuration(clients: {
default: {
database: "ultimate_test",
hosts: [connect_host],
options: {
connect_timeout: 1,
server_selection_timeout: 1
}
}
})
client = Mongoid::Clients.default
assert_timeout(Mongo::Error::NoServerAvailable) do
client[:artists].find.count
end
end
def test_read
Mongoid.load_configuration(clients: {
default: {
database: "ultimate_test",
hosts: [read_host_and_port],
options: {
connect_timeout: 1,
server_selection_timeout: 1
}
}
})
client = Mongoid::Clients.default
assert_timeout(Mongo::Error::NoServerAvailable) do
client[:artists].find.count
end
end
end