mongo_adaptor 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,10 +27,10 @@ class MongoAdaptor
27
27
  end
28
28
 
29
29
  def execute query_or_model, command
30
- if query_or_model.respond_to? :id
31
- query = { "_id" => query_or_model.id }
32
- else
30
+ if query_or_model.is_a? Hash
33
31
  query = query_or_model
32
+ else
33
+ query = { "_id" => query_or_model.id }
34
34
  end
35
35
  @collection.update query, command, safe_mode.merge(upsert_mode false)
36
36
  end
@@ -1,3 +1,3 @@
1
1
  class MongoAdaptor
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -88,7 +88,7 @@ describe 'adapting structs into mongo' do
88
88
 
89
89
  describe 'to update it with a custom operation' do
90
90
  let(:data) { collection.find({}).to_a[-1] }
91
- subject { adaptor.execute model, "$addToSet" => { "members" => "Some Other Members" } }
91
+ subject { adaptor.execute model, "$push" => { "members" => "Some Other Members" } }
92
92
 
93
93
  it 'doesnt change the number of items in the collection' do
94
94
  expect { subject }.to change { collection.size }.by(0)
@@ -101,7 +101,7 @@ describe 'adapting structs into mongo' do
101
101
  data['members'].should == ['Some Members','Some Other Members']
102
102
  end
103
103
  it 'also can execute my command by query' do
104
- adaptor.execute({ "name" => 'My Model'}, "$addToSet" => { "members" => "Some Other Members" })
104
+ adaptor.execute({ "name" => 'My Model'}, "$push" => { "members" => "Some Other Members" })
105
105
  data['members'].should == ['Some Members','Some Other Members']
106
106
  end
107
107
  end
metadata CHANGED
@@ -1,103 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mongo_adaptor
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.12
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 13
10
+ version: 0.0.13
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Jon Rowe
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-05-09 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-05-09 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: mongo
16
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
23
31
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
32
+ type: :runtime
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
31
35
  name: bson
32
- requirement: !ruby/object:Gem::Requirement
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
33
37
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
39
45
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
46
+ type: :runtime
47
+ requirement: *id002
48
+ - !ruby/object:Gem::Dependency
47
49
  name: mongo-configure
48
- requirement: !ruby/object:Gem::Requirement
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
51
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
55
59
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
60
+ type: :runtime
61
+ requirement: *id003
62
+ - !ruby/object:Gem::Dependency
63
63
  name: rake
64
- requirement: !ruby/object:Gem::Requirement
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
65
65
  none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
71
73
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
74
+ type: :development
75
+ requirement: *id004
76
+ - !ruby/object:Gem::Dependency
79
77
  name: rspec
80
- requirement: !ruby/object:Gem::Requirement
78
+ version_requirements: &id005 !ruby/object:Gem::Requirement
81
79
  none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
87
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
88
+ type: :development
89
+ requirement: *id005
94
90
  description: A simple mongo handler. Translates Structs into Mongo and back.
95
- email:
91
+ email:
96
92
  - hello@jonrowe.co.uk
97
93
  executables: []
94
+
98
95
  extensions: []
96
+
99
97
  extra_rdoc_files: []
100
- files:
98
+
99
+ files:
101
100
  - .gitignore
102
101
  - .travis.yml
103
102
  - Gemfile
@@ -110,33 +109,36 @@ files:
110
109
  - spec/mongo_adaptor_spec.rb
111
110
  homepage: https://github.com/JonRowe/MongoAdaptor
112
111
  licenses: []
112
+
113
113
  post_install_message:
114
114
  rdoc_options: []
115
- require_paths:
115
+
116
+ require_paths:
116
117
  - lib
117
- required_ruby_version: !ruby/object:Gem::Requirement
118
+ required_ruby_version: !ruby/object:Gem::Requirement
118
119
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
122
- version: '0'
123
- segments:
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
124
125
  - 0
125
- hash: -2106155663836769840
126
- required_rubygems_version: !ruby/object:Gem::Requirement
126
+ version: "0"
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- segments:
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
133
134
  - 0
134
- hash: -2106155663836769840
135
+ version: "0"
135
136
  requirements: []
137
+
136
138
  rubyforge_project:
137
139
  rubygems_version: 1.8.25
138
140
  signing_key:
139
141
  specification_version: 3
140
142
  summary: A simple mongo handler. Translates Structs into Mongo and back.
141
- test_files:
143
+ test_files:
142
144
  - spec/mongo_adaptor_spec.rb