mongo-configure 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongo/configure.rb +3 -6
- data/lib/mongo/configure/version.rb +1 -1
- data/mongo-configure.gemspec +1 -2
- data/spec/mongo/configure_spec.rb +5 -18
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a4f0177e05c49677cb1e370fd2b048541921e3
|
4
|
+
data.tar.gz: 5e48e136b249325cfbe192d20d673accd1b689b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62bf3a639f03ad2218a7d6135b3d87b422055f62b504905af5b700897499ba7d79c3d132253187106be6263ce525ae534b4aa93b820e8d27c8fbaf7bd053dcf6
|
7
|
+
data.tar.gz: 330a3215de1262e8be1bf00a415a6da67278b0ab51ab791d4c052cf46650681951ac78dddc92703fa5282e9fa81995607a69c1257f63e082d46660bd05a001d4
|
data/lib/mongo/configure.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'morphine'
|
2
1
|
require 'mongo'
|
3
2
|
require 'mongo/configure/version'
|
4
3
|
require 'mongo/configure/uri'
|
@@ -7,16 +6,14 @@ module Mongo
|
|
7
6
|
module Configure
|
8
7
|
|
9
8
|
class Config
|
10
|
-
include Morphine
|
11
|
-
|
12
|
-
register(:connection) { ::Mongo::Connection }
|
13
|
-
|
14
9
|
def initialize(uri)
|
15
10
|
@uri = uri
|
16
11
|
end
|
12
|
+
|
17
13
|
attr_reader :uri
|
14
|
+
|
18
15
|
def load
|
19
|
-
|
16
|
+
Mongo::Client.new(@uri.to_s).database
|
20
17
|
end
|
21
18
|
end
|
22
19
|
|
data/mongo-configure.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'mongo/configure'
|
2
2
|
|
3
|
-
describe 'configuring databases' do
|
3
|
+
RSpec.describe 'configuring databases' do
|
4
4
|
describe 'from a uri' do
|
5
5
|
let(:config) { Mongo::Configure.from_uri('secretsquirrel://server.name:666/data').uri }
|
6
6
|
|
@@ -45,27 +45,14 @@ describe 'configuring databases' do
|
|
45
45
|
|
46
46
|
describe 'loading a connection from the configuration' do
|
47
47
|
let(:configuration) { Mongo::Configure.current }
|
48
|
-
let(:fake_connector) { double :from_uri => fake_connection }
|
49
|
-
let(:fake_connection) { double :db => database }
|
50
|
-
let(:database) { double }
|
51
48
|
|
52
49
|
before do
|
53
|
-
Mongo::
|
54
|
-
|
50
|
+
Mongo::Logger.level = :error
|
51
|
+
Mongo::Configure.from_uri 'mongodb://127.0.0.1:27017/test'
|
55
52
|
end
|
56
53
|
|
57
|
-
it
|
58
|
-
expect(
|
59
|
-
configuration.load
|
60
|
-
end
|
61
|
-
|
62
|
-
it "gets the database named" do
|
63
|
-
expect(fake_connection).to receive(:db).with "data"
|
64
|
-
configuration.load
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'returns the database' do
|
68
|
-
expect(configuration.load).to eq database
|
54
|
+
it 'loads the database from config and returns the database' do
|
55
|
+
expect(configuration.load).to be_a Mongo::Database
|
69
56
|
end
|
70
57
|
end
|
71
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo-configure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Rowe
|
@@ -10,34 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: morphine
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: mongo
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - "
|
17
|
+
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
19
|
+
version: '2.4'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- - "
|
24
|
+
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
26
|
+
version: '2.4'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|