summaryrefslogtreecommitdiff
path: root/engines/support/test
diff options
context:
space:
mode:
authorazul <azul@leap.se>2014-07-10 11:06:20 +0200
committerazul <azul@leap.se>2014-07-10 11:06:20 +0200
commitc9dd5a342f902b27aec73af24776025a03feda48 (patch)
tree83472ae6cb3bbab1479e585e90de1fad9f45382b /engines/support/test
parentdc740e4311101bf7297996788b25a99edafbe759 (diff)
parent7b368ac4825686458be38460d8a77f4e9e0139ef (diff)
Merge pull request #174 from azul/bugfix/admin-navigates-all-tickets
Admin navigates all tickets - fixes #5879
Diffstat (limited to 'engines/support/test')
-rw-r--r--engines/support/test/functional/tickets_controller_test.rb5
-rw-r--r--engines/support/test/integration/navigation_test.rb19
-rw-r--r--engines/support/test/test_helper.rb1
3 files changed, 18 insertions, 7 deletions
diff --git a/engines/support/test/functional/tickets_controller_test.rb b/engines/support/test/functional/tickets_controller_test.rb
index ebaa3a4..e36f5f6 100644
--- a/engines/support/test/functional/tickets_controller_test.rb
+++ b/engines/support/test/functional/tickets_controller_test.rb
@@ -64,11 +64,12 @@ class TicketsControllerTest < ActionController::TestCase
assert_access_denied
end
- test "ticket list of other user is not visible" do
+ test "normal user only gets own ticket list" do
other_user = find_record :user
login
get :index, :user_id => other_user.id
- assert_access_denied
+ assert_equal @current_user, assigns(:user)
+ assert_nil assigns(:tickets).detect{|t| t.created_by != @user}
end
test "should create unauthenticated ticket" do
diff --git a/engines/support/test/integration/navigation_test.rb b/engines/support/test/integration/navigation_test.rb
index eec8c0e..13d51b6 100644
--- a/engines/support/test/integration/navigation_test.rb
+++ b/engines/support/test/integration/navigation_test.rb
@@ -1,9 +1,20 @@
require 'test_helper'
-class NavigationTest < ActionDispatch::IntegrationTest
+class NavigationTest < BrowserIntegrationTest
- # test "the truth" do
- # assert true
- # end
+ #
+ # this is a regression test for #5879
+ #
+ test "admin can navigate all tickets" do
+ login
+ with_config admins: [@user.login] do
+ visit '/'
+ click_on 'Tickets'
+ click_on 'Created at'
+ uri = URI.parse(current_url)
+ assert_equal '/tickets', uri.path
+ assert_equal 'sort_order=created_at_desc', uri.query
+ end
+ end
end
diff --git a/engines/support/test/test_helper.rb b/engines/support/test/test_helper.rb
index fff9173..57cdd63 100644
--- a/engines/support/test/test_helper.rb
+++ b/engines/support/test/test_helper.rb
@@ -1,7 +1,6 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../../../test/dummy/config/environment', __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!