Class | MessageTest |
In: |
../../../test/unit/email_test.rb
|
Parent: | Test::Unit::TestCase |
# File ../../../test/unit/email_test.rb, line 7 7: def test_should_mark_email_read 8: m = emails(:abby_to_sam_1) 9: assert_nil m.read_at 10: m.mark_email_read(users(:sam)) 11: assert_not_nil m.read_at 12: end
# File ../../../test/unit/email_test.rb, line 14 14: def test_should_purge_email 15: m = emails(:abby_to_sam_Trash_2) 16: n = m.id 17: assert_not_nil m 18: m.purge 19: m = Message.find_by_id(n) 20: assert_nil m 21: end
# File ../../../test/unit/email_test.rb, line 23 23: def test_should_require_body 24: assert_no_difference Message, :count do 25: m = create_email(:body => nil) 26: assert m.errors.on(:body) 27: end 28: end
# File ../../../test/unit/email_test.rb, line 30 30: def test_should_require_recipient 31: assert_no_difference Message, :count do 32: m = create_email(:recipient => nil) 33: assert m.errors.on(:recipient) 34: end 35: end
# File ../../../test/unit/email_test.rb, line 37 37: def test_should_require_subject 38: assert_no_difference Message, :count do 39: m = create_email(:subject => nil) 40: assert m.errors.on(:subject) 41: end 42: end
# File ../../../test/unit/email_test.rb, line 49 49: def test_should_return_receiver_name 50: m = create_email 51: m.receiver = users(:sam) 52: assert_not_nil m.receiver_name 53: end
# File ../../../test/unit/email_test.rb, line 44 44: def test_should_return_sender_name 45: m = create_email 46: assert_not_nil m.sender_name 47: end
# File ../../../test/unit/email_test.rb, line 58 58: def assert_difference(object, method = nil, difference = 1) 59: initial_value = object.send(method) 60: yield 61: assert_equal initial_value + difference, object.send(method), "#{object}##{method}" 62: end
# File ../../../test/unit/email_test.rb, line 64 64: def assert_no_difference(object, method, &block) 65: assert_difference object, method, 0, &block 66: end