]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/composite_primary_keys-1.1.0/test/test_tutorial_examle.rb
Patch composite_primary_keys to work around issue when one component of
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / test / test_tutorial_examle.rb
1 require 'abstract_unit'
2 require 'fixtures/user'
3 require 'fixtures/group'
4 require 'fixtures/membership_status'
5 require 'fixtures/membership'
6
7 class TestTutorialExample < Test::Unit::TestCase
8   fixtures :users, :groups, :memberships, :membership_statuses
9   
10   def test_membership
11     assert(membership = Membership.find(1,1), "Cannot find a membership")
12     assert(membership.user)
13     assert(membership.group)
14   end
15   
16   def test_status
17     assert(membership = Membership.find(1,1), "Cannot find a membership")
18     assert(statuses = membership.statuses, "No has_many association to status")
19     assert_equal(membership, statuses.first.membership)
20   end
21   
22   def test_count
23     assert(membership = Membership.find(1,1), "Cannot find a membership")
24     assert_equal(1, membership.statuses.count)
25   end
26 end