diff options
author | Azul <azul@leap.se> | 2012-10-11 12:52:40 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-10-11 12:52:40 +0200 |
commit | 10441deba145f53604ca3b981374f1ee6619c400 (patch) | |
tree | 90d2a851cd558652121182937a5ec8373722cab0 /help/test/unit/ticket_comment_test.rb | |
parent | 61d73ac517ccbcc7ca8892010ef89e861052807f (diff) | |
parent | 33ef3d2ac9a03b06ff29f1367c69731a89f1dfc7 (diff) |
Merge branch 'release-0.1.0'
Diffstat (limited to 'help/test/unit/ticket_comment_test.rb')
-rw-r--r-- | help/test/unit/ticket_comment_test.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/help/test/unit/ticket_comment_test.rb b/help/test/unit/ticket_comment_test.rb index 37e6e67..883720f 100644 --- a/help/test/unit/ticket_comment_test.rb +++ b/help/test/unit/ticket_comment_test.rb @@ -25,21 +25,32 @@ class TicketCommentTest < ActiveSupport::TestCase #tc.ticket = Ticket.find_by_title("test title") #tc.ticket.title end + +=begin + test "create authenticated comment" do + User.current = 4 + comment2 = TicketComment.new :body => "help my email is broken!" + comment2.valid? #save # should not save comment + assert_not_nil comment2.posted_by + end +=end test "add comments" do testticket = Ticket.create :title => "testing" assert_equal testticket.comments.count, 0 comment = TicketComment.new :body => "my email broke" - assert comment.valid? #validating or saving necessary for setting posted_at - assert_not_nil comment.posted_at + #assert comment.valid? #validating or saving necessary for setting posted_at + #assert_not_nil comment.posted_at testticket.comments << comment assert_equal testticket.comments.count, 1 sleep(1) # so first comment has earlier posted_at time comment2 = TicketComment.new :body => "my email broke" - comment2.save #possible to save only if ticketcomment is a model now - testticket.comments << comment2 + testticket.comments << comment2 #this should validate comment2 + testticket.valid? assert_equal testticket.comments.count, 2 + assert_not_nil comment.posted_at + assert_not_nil testticket.comments.last.posted_at assert testticket.comments.first.posted_at < testticket.comments.last.posted_at end |