summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-02-06 19:03:40 +0100
committerAzul <azul@leap.se>2014-02-06 19:03:40 +0100
commitd8aa92f9d4911e28c95e9abb70e87ac282ef0601 (patch)
tree49c443114074590f1758c02c5897f878d3199381 /help
parente96d21ed7d2fce1d07fc381200d31919a2d93299 (diff)
make sure ticket get's cleared at end of tickets_by_admin test
Also relax the requirement from tickets.count > 1 to > 0. There is only one ticket if there have not been any others in the database ahead of time.
Diffstat (limited to 'help')
-rw-r--r--help/test/functional/tickets_controller_test.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/help/test/functional/tickets_controller_test.rb b/help/test/functional/tickets_controller_test.rb
index 2b30f66..2530ba1 100644
--- a/help/test/functional/tickets_controller_test.rb
+++ b/help/test/functional/tickets_controller_test.rb
@@ -158,19 +158,23 @@ class TicketsControllerTest < ActionController::TestCase
end
test "tickets by admin" do
- other_user = find_record :user
- ticket = FactoryGirl.create :ticket, :created_by => other_user.id
+ begin
+ other_user = find_record :user
+ ticket = FactoryGirl.create :ticket, :created_by => other_user.id
- login :is_admin? => true
+ login :is_admin? => true
- get :index, {:admin_status => "all", :open_status => "open"}
- assert assigns(:all_tickets).count > 1
-
- # if we close one ticket, the admin should have 1 less open ticket
- assert_difference('assigns[:all_tickets].count', -1) do
- assigns(:tickets).first.close
- assigns(:tickets).first.save
get :index, {:admin_status => "all", :open_status => "open"}
+ assert assigns(:all_tickets).count > 0
+
+ # if we close one ticket, the admin should have 1 less open ticket
+ assert_difference('assigns[:all_tickets].count', -1) do
+ assigns(:tickets).first.close
+ assigns(:tickets).first.save
+ get :index, {:admin_status => "all", :open_status => "open"}
+ end
+ ensure
+ ticket.reload.destroy if ticket
end
end