mongo_adaptor 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 32d24e8595ab068f45ad10271e3a49cc659bdfe2
4
+ data.tar.gz: 267ab227bc343562e7a65856863b0a03913eb995
5
+ SHA512:
6
+ metadata.gz: 11c3dfa2fc3f05088185b8bed02fa2064de84bb020394cf3e786bbdf547c44ab99e4b4d1e8b32f3708b5990194f78b7f268a08c4683d7a4f4bb3dd21a8168eb3
7
+ data.tar.gz: e3a746c3db2d424859461c718247aaf2cbd1b08564daf922b9a8420f04fa82ea82c9b44a900a90c5d23a1b7ead76da1a9759d3bd579c378a598d3933d5e09837
data/.travis.yml CHANGED
@@ -1,15 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.2
4
+ - 2.1.1
3
5
  - 2.0.0
4
6
  - 1.9.3
5
7
  - 1.9.2
6
8
  - jruby-18mode
7
9
  - jruby-19mode
8
- - rbx-19mode
10
+ - rbx-2
9
11
  - 1.8.7
10
12
  - ree
11
- matrix:
12
- allow_failures:
13
- - rvm:
14
- - rbx-18mode
15
13
  services: mongodb
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mongo_adaptor.gemspec
4
4
  gemspec
5
+
6
+ platform :rbx do
7
+ gem 'rubysl'
8
+ end
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- [![Build Status](https://secure.travis-ci.org/JonRowe/MongoAdaptor.png)](http://travis-ci.org/JonRowe/MongoAdaptor)
2
1
  # MongoAdaptor
2
+ [![Build Status](https://secure.travis-ci.org/JonRowe/MongoAdaptor.png)](http://travis-ci.org/JonRowe/MongoAdaptor) [![Code Climate](https://codeclimate.com/github/JonRowe/MongoAdaptor.png)](https://codeclimate.com/github/JonRowe/MongoAdaptor)
3
3
 
4
4
  A simple mongo handler. Translates Structs into Mongo and back.
5
5
 
data/lib/mongo_adaptor.rb CHANGED
@@ -7,6 +7,10 @@ class MongoAdaptor
7
7
  def db
8
8
  @db ||= Mongo::Configure.current.load
9
9
  end
10
+
11
+ def db= db
12
+ @db = db
13
+ end
10
14
  end
11
15
 
12
16
  def initialize name, klass
@@ -1,3 +1,3 @@
1
1
  class MongoAdaptor
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -16,9 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.version = MongoAdaptor::VERSION
17
17
 
18
18
  gem.add_dependency 'mongo'
19
- gem.add_dependency 'bson'
20
19
  gem.add_dependency 'mongo-configure'
21
20
 
22
21
  gem.add_development_dependency 'rake'
23
22
  gem.add_development_dependency 'rspec'
23
+ gem.add_development_dependency 'rspec-its'
24
24
  end
@@ -1,3 +1,4 @@
1
+ require 'rspec/its'
1
2
  require 'mongo_adaptor'
2
3
 
3
4
  describe 'adapting structs into mongo' do
@@ -6,7 +7,14 @@ describe 'adapting structs into mongo' do
6
7
 
7
8
  describe 'db setup' do
8
9
  it 'uses the configured database' do
9
- MongoAdaptor.db.name.should == 'mongo_adaptor_test'
10
+ expect(MongoAdaptor.db.name).to eq 'mongo_adaptor_test'
11
+ end
12
+
13
+ it 'can be configured' do
14
+ original = MongoAdaptor.db
15
+ MongoAdaptor.db = fake = double
16
+ expect(MongoAdaptor.db).to eq fake
17
+ MongoAdaptor.db = original
10
18
  end
11
19
  end
12
20
 
@@ -25,17 +33,17 @@ describe 'adapting structs into mongo' do
25
33
  end
26
34
  it 'generates an _id, ignoring any set key' do
27
35
  subject
28
- data['_id'].should be_a BSON::ObjectId
29
- data['id'].should be_nil
36
+ expect(data['_id']).to be_a BSON::ObjectId
37
+ expect(data['id']).to be_nil
30
38
  end
31
39
  end
32
40
  shared_examples_for 'new model' do
33
41
  it_should_behave_like 'creates a document'
34
42
  it 'sets my fields and values' do
35
43
  subject
36
- data['name'].should == 'Test Model'
37
- data['other'].should == 'Some Data'
38
- data['members'].should == 'Some Members'
44
+ expect(data['name']).to eq 'Test Model'
45
+ expect(data['other']).to eq 'Some Data'
46
+ expect(data['members']).to eq 'Some Members'
39
47
  end
40
48
  end
41
49
 
@@ -54,7 +62,7 @@ describe 'adapting structs into mongo' do
54
62
  it_should_behave_like 'creates a document'
55
63
  it 'will execute my command' do
56
64
  subject
57
- data['key'].should eq ['value']
65
+ expect(data['key']).to eq ['value']
58
66
  end
59
67
  end
60
68
  end
@@ -78,10 +86,10 @@ describe 'adapting structs into mongo' do
78
86
  end
79
87
  it 'sets my fields and values' do
80
88
  subject
81
- data['_id'].should == model.id
82
- data['name'].should == 'Test Model'
83
- data['other'].should == 'Some Data'
84
- data['members'].should == ['Some Other Members']
89
+ expect(data['_id']).to eq model.id
90
+ expect(data['name']).to eq 'Test Model'
91
+ expect(data['other']).to eq 'Some Data'
92
+ expect(data['members']).to eq ['Some Other Members']
85
93
  end
86
94
  end
87
95
 
@@ -107,17 +115,17 @@ describe 'adapting structs into mongo' do
107
115
  end
108
116
  it 'executes my command' do
109
117
  subject
110
- data['members'].should == ['Some Members','Some Other Members']
118
+ expect(data['members']).to eq ['Some Members','Some Other Members']
111
119
  end
112
120
  it 'also can execute my command by query' do
113
121
  adaptor.execute({ "name" => 'My Model'}, "$push" => { "members" => "Some Other Members" })
114
- data['members'].should == ['Some Members','Some Other Members']
122
+ expect(data['members']).to eq ['Some Members','Some Other Members']
115
123
  end
116
124
  end
117
125
 
118
126
  describe 'to fetch it' do
119
127
  subject { adaptor.fetch({ :_id => id }) }
120
- it { should be_a klass }
128
+ it { is_expected.to be_a klass }
121
129
  its(:id) { should == id }
122
130
  its(:name) { should == 'My Model' }
123
131
  its(:other) { should == 'Some Value' }
@@ -127,7 +135,7 @@ describe 'adapting structs into mongo' do
127
135
  describe 'to remove it' do
128
136
  it 'removes the document matching the selector' do
129
137
  adaptor.remove({ :_id => id })
130
- adaptor.fetch({ :_id => id }).should be_nil
138
+ expect(adaptor.fetch({ :_id => id })).to be_nil
131
139
  end
132
140
  end
133
141
  end
@@ -135,10 +143,10 @@ describe 'adapting structs into mongo' do
135
143
  describe 'finding multiples' do
136
144
  before do
137
145
  3.times do |i|
138
- collection.insert({ :name => 'My Model', :other => i },{ :safe => true })
146
+ collection.insert({ :name => 'My Model', :other => i },{ :w => 1 })
139
147
  end
140
148
  3.times do |i|
141
- collection.insert({ :name => 'Other Model', :other => i },{ :safe => true })
149
+ collection.insert({ :name => 'Other Model', :other => i },{ :w => 1 })
142
150
  end
143
151
  end
144
152
 
@@ -146,10 +154,10 @@ describe 'adapting structs into mongo' do
146
154
 
147
155
  its(:count) { should == 3 }
148
156
  it 'translates all to klass' do
149
- subject.all? { |k| k.is_a? klass }.should be_true
157
+ expect(subject.all? { |k| k.is_a? klass }).to be true
150
158
  end
151
159
  it 'gets them all' do
152
- subject.map(&:other).should == [0,1,2]
160
+ expect(subject.map(&:other)).to eq [0,1,2]
153
161
  end
154
162
  it 'will pass along options' do
155
163
  expect { adaptor.find({ :name => 'My Model' },{ :fields => { }}) }.to_not raise_error
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_adaptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
5
- prerelease:
4
+ version: 0.0.17
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jon Rowe
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-03 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: mongo
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: bson
28
+ name: mongo-configure
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: mongo-configure
42
+ name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
- type: :runtime
48
+ type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: rake
56
+ name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- name: rspec
70
+ name: rspec-its
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: A simple mongo handler. Translates Structs into Mongo and back.
@@ -98,8 +87,8 @@ executables: []
98
87
  extensions: []
99
88
  extra_rdoc_files: []
100
89
  files:
101
- - .gitignore
102
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
103
92
  - Gemfile
104
93
  - LICENSE
105
94
  - README.md
@@ -110,33 +99,26 @@ files:
110
99
  - spec/mongo_adaptor_spec.rb
111
100
  homepage: https://github.com/JonRowe/MongoAdaptor
112
101
  licenses: []
102
+ metadata: {}
113
103
  post_install_message:
114
104
  rdoc_options: []
115
105
  require_paths:
116
106
  - lib
117
107
  required_ruby_version: !ruby/object:Gem::Requirement
118
- none: false
119
108
  requirements:
120
- - - ! '>='
109
+ - - ">="
121
110
  - !ruby/object:Gem::Version
122
111
  version: '0'
123
- segments:
124
- - 0
125
- hash: 1930400006720958320
126
112
  required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
113
  requirements:
129
- - - ! '>='
114
+ - - ">="
130
115
  - !ruby/object:Gem::Version
131
116
  version: '0'
132
- segments:
133
- - 0
134
- hash: 1930400006720958320
135
117
  requirements: []
136
118
  rubyforge_project:
137
- rubygems_version: 1.8.25
119
+ rubygems_version: 2.2.2
138
120
  signing_key:
139
- specification_version: 3
121
+ specification_version: 4
140
122
  summary: A simple mongo handler. Translates Structs into Mongo and back.
141
123
  test_files:
142
124
  - spec/mongo_adaptor_spec.rb