summaryrefslogtreecommitdiff
path: root/help/test
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-11-15 12:37:35 -0800
committerjessib <jessib@leap.se>2012-11-15 12:37:35 -0800
commitf1e3b135eec6e0a6a02b920cdadd7adc5889f9e2 (patch)
tree46b8e869774aab6032849c41d5fbeeaf49d8e1f3 /help/test
parentdb758bcc770cf4e58937108fe18eefc447d09b42 (diff)
Some more ticket tests.
Diffstat (limited to 'help/test')
-rw-r--r--help/test/functional/tickets_controller_test.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/help/test/functional/tickets_controller_test.rb b/help/test/functional/tickets_controller_test.rb
index 56d81d7..35901ca 100644
--- a/help/test/functional/tickets_controller_test.rb
+++ b/help/test/functional/tickets_controller_test.rb
@@ -15,6 +15,31 @@ class TicketsControllerTest < ActionController::TestCase
assert_response :success
end
+ test "ticket show access" do
+ ticket = Ticket.first
+ ticket.created_by = nil # TODO: hacky, but this makes sure this ticket is an unauthenticated one
+ ticket.save
+ get :show, :id => ticket.id
+ assert_response :success
+
+ ticket.created_by = User.last.id
+ ticket.save
+ get :show, :id => ticket.id
+ assert_response :redirect
+ assert_redirected_to login_url
+
+ login(User.last)
+ get :show, :id => ticket.id
+ assert_response :success
+
+ login(User.first) #assumes User.first != User.last:
+ assert_not_equal User.first, User.last
+ get :show, :id => ticket.id
+ assert_response :redirect
+ assert_redirected_to root_url
+
+ end
+
test "should create unauthenticated ticket" do
params = {:title => "unauth ticket test title", :comments_attributes => {"0" => {"body" =>"body of test ticket"}}}
@@ -129,7 +154,7 @@ class TicketsControllerTest < ActionController::TestCase
end
- test "test_tickets_by_admin" do
+ test "tickets by admin" do
admin_login = APP_CONFIG['admins'].first
admin_user = User.find_by_login(admin_login) #assumes that there is an admin login
@@ -169,6 +194,5 @@ class TicketsControllerTest < ActionController::TestCase
end
-
end