Created
October 28, 2009 05:11
-
-
Save carllerche/220258 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe "Koios::Relationship" do | |
model :Owner do |sql| | |
has n, :things, :model => 'Thing', :on => :owner_id | |
end | |
model :Thing do |sql| | |
property :owner_id, Integer | |
sql << "owner_id integer" | |
end | |
before :all do | |
6.times do |i| | |
o = Owner.create | |
6.times { Thing.create :owner_id => o.id } | |
end | |
end | |
describe "#has" do | |
describe "n" do | |
before :all do | |
@relation = Owner.get(1).things | |
@expected = (1..6).map { |i| Thing.get(i) } | |
end | |
it_should_behave_like 'A public Relation' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment