Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tweaked the docs and wrote the specs to include through

  • Loading branch information...
commit 6b1f29e56a6852f945efb22de5d405e38eeff27a 1 parent ca115d5
@andykent andykent authored Dan Kubb committed
Showing with 5 additions and 15 deletions.
  1. +1 −2  lib/data_mapper/associations.rb
  2. +4 −13 spec/unit/associations_spec.rb
View
3  lib/data_mapper/associations.rb
@@ -41,8 +41,7 @@ def n
# :class_name<String>:: The name of the class to associate with, if ommitted then the association name is assumed to match the class name
#
# ==== Returns
- # DataMapper::Association:: One of - OneToOne, OneToMany, ManyToMany
- # The association created should not be accessed directly
+ # DataMapper::Association::Relationship:: The relationship that was created to reflect either a one-to-one, one-to-many or many-to-many relationship
#
# ==== Raises
# ArgumentError:: if the cardinality was not understood - should be Fixnum, Bignum, Infinity(n) or Range
View
17 spec/unit/associations_spec.rb
@@ -92,21 +92,12 @@ class Manufacturer
# ================
pending
# ================
- Manufacturer.should_receive(:many_to_many).
- with(:vehicles,{}).
- and_return(@relationship)
- class Manufacturer
- has n, :vehicles
- end
- class Vehicle
- has n, :manufacturers
- end
end
- it "should create many-to-many associations through a join model when a :through option is specified" do
- # ================
- pending
- # ================
+ it "should create one-to-many association and pass the :through option if specified" do
+ Vehicle.should_receive(:one_to_many).
+ with(:suppliers,{:through => :manufacturers}).
+ and_return(@relationship)
class Vehicle
has n, :suppliers, :through => :manufacturers
end
Please sign in to comment.
Something went wrong with that request. Please try again.