summaryrefslogtreecommitdiff
path: root/engines/support/test/functional/tickets_controller_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-20 12:30:55 +0200
committerAzul <azul@leap.se>2014-05-26 12:59:26 +0200
commit467dd712a19d48fc653cfc0e58201e6657d2c1f9 (patch)
tree44a44fec523843652d1c0bc0ba410f6e7710b3d7 /engines/support/test/functional/tickets_controller_test.rb
parent7638970e233eaebc48abd499c37c274b48c97a96 (diff)
split up and refactor TicketController#update
close and open actions for plain opening and closing the tickets respond_with so fields are not cleared on invalid update the custom actions are not strictly restful. But adding a subresource felt like too much overhead and is conceptually hard to grasp (so we destroy the openess of the ticket to close it?).
Diffstat (limited to 'engines/support/test/functional/tickets_controller_test.rb')
-rw-r--r--engines/support/test/functional/tickets_controller_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/engines/support/test/functional/tickets_controller_test.rb b/engines/support/test/functional/tickets_controller_test.rb
index e103d01..1d074cc 100644
--- a/engines/support/test/functional/tickets_controller_test.rb
+++ b/engines/support/test/functional/tickets_controller_test.rb
@@ -112,5 +112,22 @@ class TicketsControllerTest < ActionController::TestCase
assert_not_nil assigns(:ticket).comments.first.posted_by
assert_equal assigns(:ticket).comments.first.posted_by, @current_user.id
end
+
+ test "close ticket" do
+ login
+ open_ticket = FactoryGirl.create :ticket_with_comment,
+ created_by: @current_user.id
+ post :close, id: open_ticket.id
+ assert !open_ticket.reload.is_open
+ end
+
+ test "reopen ticket" do
+ login
+ open_ticket = FactoryGirl.create :ticket_with_comment,
+ created_by: @current_user.id, is_open: false
+ post :open, id: open_ticket.id
+ assert open_ticket.reload.is_open
+ end
+
end