summaryrefslogtreecommitdiff
path: root/help/test
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-20 10:57:34 +0100
committerAzul <azul@leap.se>2012-12-20 10:57:34 +0100
commit5d61ba0a80399b9e725881f857fdfa5414e5ef3f (patch)
tree041d1938f02b8aa27f68e90f8c71672ec89ce810 /help/test
parent69a6c34998328b2168053184e1e487b60e1cc536 (diff)
parentd6c881294880a934424e4d399786561d5c107167 (diff)
Merge remote-tracking branch 'origin/feature/tickets-refactor'
Diffstat (limited to 'help/test')
-rw-r--r--help/test/unit/ticket_test.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/help/test/unit/ticket_test.rb b/help/test/unit/ticket_test.rb
index e93a121..ac6426e 100644
--- a/help/test/unit/ticket_test.rb
+++ b/help/test/unit/ticket_test.rb
@@ -56,38 +56,34 @@ class TicketTest < ActiveSupport::TestCase
end
=end
- test "finds open tickets sorted by created_at" do
- tickets = Ticket.by_is_open_and_created_at.
- startkey([true, 0]).
- endkey([true, Time.now + 10.hours]) # some tickets were created in the future
- 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
# this will cause RestClient::ResourceNotFound errors if there are multiple copies of the same ticket returned
- Ticket.includes_post_by.key('123').each {|t| t.destroy}
+ Ticket.by_includes_post_by.key('123').each {|t| t.destroy}
+ # TODO: the by_includes_post_by view is only used for tests. Maybe we should get rid of it and change the test to including ordering?
+
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.includes_post_by.key('123').all
+ assert_equal [], Ticket.by_includes_post_by.key('123').all
testticket.comments << comment
testticket.save
assert_equal 1, testticket.reload.comments.count
- assert_equal [testticket], Ticket.includes_post_by.key('123').all
+ assert_equal [testticket], Ticket.by_includes_post_by.key('123').all
comment = TicketComment.new :body => "another comment", :posted_by => "123"
testticket.comments << comment
testticket.save
# this will ensure that the ticket is only included once, even though the user has commented on the ticket twice:
- assert_equal [testticket], Ticket.includes_post_by.key('123').all
+ assert_equal [testticket], Ticket.by_includes_post_by.key('123').all
testticket.destroy
- assert_equal [], Ticket.includes_post_by.key('123').all;
+ assert_equal [], Ticket.by_includes_post_by.key('123').all;
end
end