djsun-mongo_mapper 0.5.8.1 → 0.5.8.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8.1
1
+ 0.5.8.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{djsun-mongo_mapper}
8
- s.version = "0.5.8.1"
8
+ s.version = "0.5.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Nunemaker", "David James"]
@@ -61,6 +61,7 @@ Gem::Specification.new do |s|
61
61
  "test/functional/associations/test_many_embedded_proxy.rb",
62
62
  "test/functional/associations/test_many_polymorphic_proxy.rb",
63
63
  "test/functional/associations/test_many_proxy.rb",
64
+ "test/functional/associations/test_namespace.rb",
64
65
  "test/functional/test_associations.rb",
65
66
  "test/functional/test_binary.rb",
66
67
  "test/functional/test_callbacks.rb",
@@ -104,6 +105,7 @@ Gem::Specification.new do |s|
104
105
  "test/functional/associations/test_many_embedded_proxy.rb",
105
106
  "test/functional/associations/test_many_polymorphic_proxy.rb",
106
107
  "test/functional/associations/test_many_proxy.rb",
108
+ "test/functional/associations/test_namespace.rb",
107
109
  "test/functional/test_associations.rb",
108
110
  "test/functional/test_binary.rb",
109
111
  "test/functional/test_callbacks.rb",
@@ -1,3 +1,5 @@
1
+ require 'rubygems'
2
+ gem 'activesupport', '>= 2.3'
1
3
  require 'active_support'
2
4
  require 'mongo'
3
5
  require 'validatable'
@@ -0,0 +1,33 @@
1
+ require 'test_helper'
2
+ require 'models'
3
+
4
+ class NamespaceTest < Test::Unit::TestCase
5
+ include Hollywood
6
+
7
+ def setup
8
+ Movie.collection.remove
9
+ Actor.collection.remove
10
+ Role.collection.remove
11
+ end
12
+
13
+ context "Hollywood namespace" do
14
+ setup do
15
+ @movie = Movie.create
16
+ @actor = Actor.create
17
+ @role = Role.create(
18
+ :movie_id => @movie.id,
19
+ :actor_id => @actor.id
20
+ )
21
+ end
22
+
23
+ should "belongs_to associations" do
24
+ @role.actor.should == @actor
25
+ @role.movie.should == @movie
26
+ end
27
+
28
+ should "many associations" do
29
+ @movie.roles.should == [@role]
30
+ @actor.roles.should == [@role]
31
+ end
32
+ end
33
+ end
@@ -269,3 +269,27 @@ module TrModels
269
269
  key :name, String
270
270
  end
271
271
  end
272
+
273
+ module Hollywood
274
+ class Movie
275
+ include MongoMapper::Document
276
+
277
+ many :roles, :class_name => "Hollywood::Role", :foreign_key => :movie_id
278
+ end
279
+
280
+ class Actor
281
+ include MongoMapper::Document
282
+
283
+ many :roles, :class_name => "Hollywood::Role", :foreign_key => :actor_id
284
+ end
285
+
286
+ class Role
287
+ include MongoMapper::Document
288
+
289
+ key :movie_id, String
290
+ key :actor_id, String
291
+
292
+ belongs_to :movie, :class_name => "Hollywood::Movie"
293
+ belongs_to :actor, :class_name => "Hollywood::Actor"
294
+ end
295
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djsun-mongo_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8.1
4
+ version: 0.5.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -136,6 +136,7 @@ files:
136
136
  - test/functional/associations/test_many_embedded_proxy.rb
137
137
  - test/functional/associations/test_many_polymorphic_proxy.rb
138
138
  - test/functional/associations/test_many_proxy.rb
139
+ - test/functional/associations/test_namespace.rb
139
140
  - test/functional/test_associations.rb
140
141
  - test/functional/test_binary.rb
141
142
  - test/functional/test_callbacks.rb
@@ -201,6 +202,7 @@ test_files:
201
202
  - test/functional/associations/test_many_embedded_proxy.rb
202
203
  - test/functional/associations/test_many_polymorphic_proxy.rb
203
204
  - test/functional/associations/test_many_proxy.rb
205
+ - test/functional/associations/test_namespace.rb
204
206
  - test/functional/test_associations.rb
205
207
  - test/functional/test_binary.rb
206
208
  - test/functional/test_callbacks.rb