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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30ffa3ba52cbc1cb59d841446e1b93d5557aaa74
4
- data.tar.gz: 6a5c5f34442dc9163316d82452ec3265b4502d89
3
+ metadata.gz: 97a4f0177e05c49677cb1e370fd2b048541921e3
4
+ data.tar.gz: 5e48e136b249325cfbe192d20d673accd1b689b4
5
5
  SHA512:
6
- metadata.gz: 915a193ad76d7b7bfd11a8942055fa63ea014bbd10a27a89002b1f1f12885f74de26f003547a57a82b8ffa98fb4ad0558391aee42b6fb4b5fb2e183d33c46d3d
7
- data.tar.gz: a53fbe0acea7a35d567fee9788b9b817aeda7517274df2f59ea79cc6f39bfa077bbf62dfc30ee96bf13c444aa3a6b64dfded3ac689b9745c968d504003c27bcc
6
+ metadata.gz: 62bf3a639f03ad2218a7d6135b3d87b422055f62b504905af5b700897499ba7d79c3d132253187106be6263ce525ae534b4aa93b820e8d27c8fbaf7bd053dcf6
7
+ data.tar.gz: 330a3215de1262e8be1bf00a415a6da67278b0ab51ab791d4c052cf46650681951ac78dddc92703fa5282e9fa81995607a69c1257f63e082d46660bd05a001d4
@@ -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
- connection.from_uri(@uri.to_s).db @uri.database
16
+ Mongo::Client.new(@uri.to_s).database
20
17
  end
21
18
  end
22
19
 
@@ -1,5 +1,5 @@
1
1
  module Mongo
2
2
  module Configure
3
- VERSION = "1.0.1"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -18,8 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9.3'
20
20
 
21
- gem.add_dependency 'morphine'
22
- gem.add_dependency 'mongo'
21
+ gem.add_dependency 'mongo', '~> 2.4'
23
22
 
24
23
  gem.add_development_dependency 'rspec'
25
24
 
@@ -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::Configure.from_uri 'secretsquirrel://server.name:666/data'
54
- configuration.connection = fake_connector
50
+ Mongo::Logger.level = :error
51
+ Mongo::Configure.from_uri 'mongodb://127.0.0.1:27017/test'
55
52
  end
56
53
 
57
- it "loads the database from uri" do
58
- expect(fake_connector).to receive(:from_uri).with 'secretsquirrel://server.name:666/data'
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: 1.0.1
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: '0'
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: '0'
26
+ version: '2.4'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement