Commit ca3abf86681aa65801856a5e073ea2a65fb99acb
1 parent
bdfc4145
Exists in
master
and in
28 other branches
ActionItem36: adding a minimal Friendship class
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1459 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
22 additions
and
9 deletions
Show diff stats
app/models/friendship.rb
test/fixtures/friendships.yml
test/unit/friendship_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | 3 | class FriendshipTest < Test::Unit::TestCase |
4 | - fixtures :friendships | |
5 | 4 | |
6 | - # Replace this with your real tests. | |
7 | - def test_truth | |
8 | - assert true | |
5 | + should 'connect a person to another' do | |
6 | + p1 = Person.new | |
7 | + p2 = Person.new | |
8 | + | |
9 | + f = Friendship.new | |
10 | + assert_raise ActiveRecord::AssociationTypeMismatch do | |
11 | + f.person = Organization.new | |
12 | + end | |
13 | + assert_raise ActiveRecord::AssociationTypeMismatch do | |
14 | + f.friend = Organization.new | |
15 | + end | |
16 | + assert_nothing_raised do | |
17 | + f.person = p1 | |
18 | + f.friend = p2 | |
19 | + end | |
20 | + | |
21 | + f.save! | |
22 | + | |
9 | 23 | end |
24 | + | |
10 | 25 | end | ... | ... |