Skip to content

Commit

Permalink
added a spec for many-to-many
Browse files Browse the repository at this point in the history
  • Loading branch information
andykent authored and Dan Kubb committed Apr 20, 2008
1 parent 09e1509 commit 8c24e7c
Showing 1 changed file with 12 additions and 34 deletions.
46 changes: 12 additions & 34 deletions spec/unit/associations_spec.rb
Expand Up @@ -87,41 +87,19 @@ class Manufacturer
:class_name => 'Car'
end
end

it "should create a many-to-many relationship if references are circular" do
Manufacturer.should_receive(:many_to_many).
with(:vehicles,{}).
and_return(@relationship)
class Manufacturer
has n, :vehicles
end
class Vehicle
has n, :manufacturers
end
end
end

# describe "many-to-many syntax" do
# it "should create a basic many-to-one association with no constraints" do
# Manufacturer.should_receive(:many_to_many).
# with(:vehicles,{}).
# and_return(@relationship)
# class Manufacturer
# has n..n, :vehicles
# end
# end
#
# it "should create a many-to-many association with fixed constraints" do
# Manufacturer.should_receive(:many_to_many).
# with(:vehicles, :left=>{:min=>4, :max=>4}, :right=>{:min=>4, :max=>4}).
# and_return(@relationship)
# class Manufacturer
# has 4..4, :vehicles
# end
# end
#
# it "should create a many-to-many association with min/max constraints" do
# pending
# end
#
# it "should create a many-to-many association with options" do
# Manufacturer.should_receive(:many_to_many).
# with(:vehicles,{:class_name => 'Car'}).
# and_return(@relationship)
# class Manufacturer
# has n..n, :vehicles,
# :class_name => 'Car'
# end
# end
# end
end

describe ".belongs_to" do
Expand Down

0 comments on commit 8c24e7c

Please sign in to comment.