Permalink
Browse files

Message relation test

  • Loading branch information...
1 parent e4b3c95 commit 9ece0985460f9d70f633985b510143ae0cfec5e6 @zmcartor zmcartor committed Mar 3, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/unit/message_test.rb
View
@@ -10,4 +10,17 @@ class MessageTest < ActiveSupport::TestCase
assert !mess.save , 'message saved with no text, bummer!'
end
+ test 'message has a receiver and sender' do
+ message = build(:message)
+ sender = create(:user , email: 'kimjongun@dprk.kr')
+ receiver = create(:user , email: 'barak@us.gov')
+
+ message.to = receiver.id
+ message.from = sender.id
+ message.save
+
+ assert receiver.messages_inbox.count ==1, 'message not in receiver inbox!'
+ assert sender.messages_outbox.count ==1, 'message not in sender outbox!'
+ end
+
end

0 comments on commit 9ece098

Please sign in to comment.