summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-27 15:01:37 +0100
committerAzul <azul@leap.se>2012-11-27 15:01:37 +0100
commita4fd38b7cce5fbc5ccdab670f31ab5f74c2bdf03 (patch)
treef9ff53db8617c59948f4614a25326648eeeae925 /help
parent15d13d9abb9165b23369ea91d58505ca98d48b31 (diff)
testing Ticket#by_commented_by
Diffstat (limited to 'help')
-rw-r--r--help/test/unit/ticket_test.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/help/test/unit/ticket_test.rb b/help/test/unit/ticket_test.rb
index 73a2af5..8d6d197 100644
--- a/help/test/unit/ticket_test.rb
+++ b/help/test/unit/ticket_test.rb
@@ -63,7 +63,22 @@ class TicketTest < ActiveSupport::TestCase
assert_equal Ticket.by_is_open.key(true).count, tickets.count
end
+ test "find tickets user commented on" do
+ # clear old tickets just in case
+ Ticket.by_commented_by.key('123').each {|t| t.destroy}
-end
+ testticket = Ticket.create :title => "test retrieving commented tickets"
+ comment = TicketComment.new :body => "my email broke", :posted_by => "123"
+ assert_equal 0, testticket.comments.count
+ assert_equal [], Ticket.by_commented_by.key('123').all;
+
+ testticket.comments << comment
+ testticket.save
+ assert_equal 1, testticket.reload.comments.count
+ assert_equal [testticket], Ticket.by_commented_by.key('123').all;
+ testticket.destroy
+ assert_equal [], Ticket.by_commented_by.key('123').all;
+ end
+end