mongo_doc 0.6.21 → 0.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo_doc (0.6.21)
4
+ mongo_doc (0.6.22)
5
5
  activemodel (>= 3.0.0.beta.4)
6
6
  activesupport (>= 3.0.0.beta.4)
7
7
  bson (>= 1.0.0)
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. MongoDoc
2
2
 
3
- Version: 0.6.21 2010/08/29
3
+ Version: 0.6.22 2010/09/08
4
4
 
5
5
  h2. Notes
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.21
1
+ 0.6.22
@@ -32,7 +32,7 @@ module MongoDoc
32
32
  references_by_dbref(options[:as_ref])
33
33
  else
34
34
  klass = args[0].to_s.camelize
35
- references_by_id(klass, options[:as] || klass.to_s.demodulize.downcase)
35
+ references_by_id(klass, options[:as] || klass.to_s.demodulize.underscore)
36
36
  end
37
37
  end
38
38
 
@@ -73,7 +73,7 @@ module MongoDoc
73
73
  references_many_by_dbref(options[:as_ref].to_s)
74
74
  else
75
75
  klass = args[0].to_s.singularize.camelize
76
- references_many_by_id(klass, options[:as].try(:to_s) || klass.demodulize.downcase.pluralize)
76
+ references_many_by_id(klass, options[:as].try(:to_s) || klass.demodulize.underscore.pluralize)
77
77
  end
78
78
  end
79
79
 
data/lib/mongo_doc.rb CHANGED
@@ -3,7 +3,7 @@ require 'active_support'
3
3
  require 'active_support/core_ext'
4
4
 
5
5
  module MongoDoc
6
- VERSION = '0.6.21'
6
+ VERSION = '0.6.22'
7
7
  end
8
8
 
9
9
  require 'mongo_doc/connection'
data/mongo_doc.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongo_doc}
8
- s.version = "0.6.21"
8
+ s.version = "0.6.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Les Hill"]
12
- s.date = %q{2010-09-01}
12
+ s.date = %q{2010-09-08}
13
13
  s.description = %q{ODM for MongoDB}
14
14
  s.email = %q{leshill@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe MongoDoc::ReferencesMany do
4
- class Address
4
+ class PostalAddress
5
5
  include MongoDoc::Document
6
6
 
7
7
  attr_accessor :state
@@ -11,60 +11,60 @@ describe MongoDoc::ReferencesMany do
11
11
  class PersonSimple
12
12
  include MongoDoc::Document
13
13
 
14
- references_many :addresses
14
+ references_many :postal_addresses
15
15
  end
16
16
 
17
17
  let(:person) { PersonSimple.new }
18
18
  subject { person }
19
19
 
20
20
  context "Object accessor" do
21
- it { should respond_to(:addresses) }
22
- it { should respond_to(:addresses=) }
21
+ it { should respond_to(:postal_addresses) }
22
+ it { should respond_to(:postal_addresses=) }
23
23
 
24
24
  it "is not part of the persistent key set" do
25
- PersonSimple._keys.should_not include('addresses')
25
+ PersonSimple._keys.should_not include('postal_addresses')
26
26
  end
27
27
  end
28
28
 
29
29
  context "Object Id accessor" do
30
- it { should respond_to(:address_ids) }
31
- it { should respond_to(:address_ids=) }
30
+ it { should respond_to(:postal_address_ids) }
31
+ it { should respond_to(:postal_address_ids=) }
32
32
 
33
33
  it "is part of the persistent key set" do
34
- PersonSimple._keys.should include('address_ids')
34
+ PersonSimple._keys.should include('postal_address_ids')
35
35
  end
36
36
  end
37
37
 
38
38
  context "setting the ids" do
39
- let(:address) { Address.new(:_id => BSON::ObjectID.new) }
39
+ let(:postal_address) { PostalAddress.new(:_id => BSON::ObjectID.new) }
40
40
 
41
41
  before do
42
- person.addresses = [address]
42
+ person.postal_addresses = [postal_address]
43
43
  end
44
44
 
45
45
  context "to nil" do
46
46
  before do
47
- person.address_ids = nil
47
+ person.postal_address_ids = nil
48
48
  end
49
49
 
50
- its(:address_ids) { should == [] }
51
- its(:addresses) { should == [] }
50
+ its(:postal_address_ids) { should == [] }
51
+ its(:postal_addresses) { should == [] }
52
52
  end
53
53
 
54
54
  context "to []" do
55
55
  before do
56
- person.address_ids = []
56
+ person.postal_address_ids = []
57
57
  end
58
58
 
59
- its(:addresses) { should == [] }
59
+ its(:postal_addresses) { should == [] }
60
60
  end
61
61
 
62
62
  context "to strings" do
63
63
  before do
64
- person.address_ids = [address._id.to_s]
64
+ person.postal_address_ids = [postal_address._id.to_s]
65
65
  end
66
66
 
67
- its(:address_ids) { should == [address._id] }
67
+ its(:postal_address_ids) { should == [postal_address._id] }
68
68
  end
69
69
  end
70
70
  end
@@ -73,7 +73,7 @@ describe MongoDoc::ReferencesMany do
73
73
  class PersonNamed
74
74
  include MongoDoc::Document
75
75
 
76
- references_many :addresses, :as => :known_addresses
76
+ references_many :postal_addresses, :as => :known_addresses
77
77
  end
78
78
 
79
79
  let(:person) { PersonNamed.new }
@@ -99,7 +99,7 @@ describe MongoDoc::ReferencesMany do
99
99
  end
100
100
 
101
101
  context "setting the ids" do
102
- let(:address) { Address.new(:_id => BSON::ObjectID.new) }
102
+ let(:address) { PostalAddress.new(:_id => BSON::ObjectID.new) }
103
103
 
104
104
  before do
105
105
  person.known_addresses = [address]
@@ -139,7 +139,7 @@ describe MongoDoc::ReferencesMany do
139
139
  references_many :as_ref => :addresses
140
140
  end
141
141
 
142
- let(:address) { Address.new(:_id => BSON::ObjectID.new) }
142
+ let(:address) { PostalAddress.new(:_id => BSON::ObjectID.new) }
143
143
  let(:person) { PersonDBRef.new }
144
144
 
145
145
  subject { person }
@@ -168,7 +168,7 @@ describe MongoDoc::ReferencesMany do
168
168
  end
169
169
 
170
170
  it "sets the refs to an array of refs]" do
171
- person.address_refs.first.namespace.should == Address.collection_name
171
+ person.address_refs.first.namespace.should == PostalAddress.collection_name
172
172
  person.address_refs.first.object_id.should == address._id
173
173
  end
174
174
  end
@@ -199,7 +199,7 @@ describe MongoDoc::ReferencesMany do
199
199
  end
200
200
 
201
201
  context "to an array of references" do
202
- let(:dbref) { ::BSON::DBRef.new(Address.collection_name, address._id) }
202
+ let(:dbref) { ::BSON::DBRef.new(PostalAddress.collection_name, address._id) }
203
203
 
204
204
  before do
205
205
  person.address_refs = [dbref]
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe MongoDoc::References do
4
- class Address
4
+ class PostalAddress
5
5
  include MongoDoc::Document
6
6
 
7
7
  attr_accessor :state
@@ -11,36 +11,36 @@ describe MongoDoc::References do
11
11
  class SimplePerson
12
12
  include MongoDoc::Document
13
13
 
14
- references :address
14
+ references :postal_address
15
15
  end
16
16
 
17
17
  subject { SimplePerson.new }
18
18
 
19
19
  context "Object accessor" do
20
- it { should respond_to(:address) }
21
- it { should respond_to(:address=) }
20
+ it { should respond_to(:postal_address) }
21
+ it { should respond_to(:postal_address=) }
22
22
 
23
23
  it "is not part of the persistent key set" do
24
- SimplePerson._keys.should_not include(:address)
24
+ SimplePerson._keys.should_not include(:postal_address)
25
25
  end
26
26
  end
27
27
 
28
28
  context "Object Id accessor" do
29
- it { should respond_to(:address_id) }
30
- it { should respond_to(:address_id=) }
29
+ it { should respond_to(:postal_address_id) }
30
+ it { should respond_to(:postal_address_id=) }
31
31
 
32
32
  it "is part of the persistent key set" do
33
- SimplePerson._keys.should include(:address_id)
33
+ SimplePerson._keys.should include(:postal_address_id)
34
34
  end
35
35
  end
36
36
 
37
37
  context "setting the id" do
38
- let(:address) { Address.new(:_id => BSON::ObjectID.new) }
38
+ let(:postal_address) { PostalAddress.new(:_id => BSON::ObjectID.new) }
39
39
 
40
40
  it "resets the object to nil" do
41
- subject.address = address
42
- subject.address_id = nil
43
- subject.address.should be_nil
41
+ subject.postal_address = postal_address
42
+ subject.postal_address_id = nil
43
+ subject.postal_address.should be_nil
44
44
  end
45
45
  end
46
46
  end
@@ -49,7 +49,7 @@ describe MongoDoc::References do
49
49
  class NamedPerson
50
50
  include MongoDoc::Document
51
51
 
52
- references :address, :as => :work_address
52
+ references :postal_address, :as => :work_address
53
53
  end
54
54
 
55
55
  subject { NamedPerson.new }
@@ -80,7 +80,7 @@ describe MongoDoc::References do
80
80
  references :as_ref => :address
81
81
  end
82
82
 
83
- let(:address) { Address.new(:_id => BSON::ObjectID.new) }
83
+ let(:address) { PostalAddress.new(:_id => BSON::ObjectID.new) }
84
84
  subject { DBRefPerson.new }
85
85
 
86
86
  context "Object accessor" do
@@ -104,7 +104,7 @@ describe MongoDoc::References do
104
104
  context "setting the object" do
105
105
  it "sets the reference" do
106
106
  subject.address = address
107
- subject.address_ref.namespace.should == Address.collection_name
107
+ subject.address_ref.namespace.should == PostalAddress.collection_name
108
108
  subject.address_ref.object_id.should == address._id
109
109
  end
110
110
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_doc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 21
10
- version: 0.6.21
9
+ - 22
10
+ version: 0.6.22
11
11
  platform: ruby
12
12
  authors:
13
13
  - Les Hill
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-01 00:00:00 -04:00
18
+ date: 2010-09-08 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency