Chris@0: # Redmine - project management software Chris@1295: # Copyright (C) 2006-2013 Jean-Philippe Lang Chris@0: # Chris@0: # This program is free software; you can redistribute it and/or Chris@0: # modify it under the terms of the GNU General Public License Chris@0: # as published by the Free Software Foundation; either version 2 Chris@0: # of the License, or (at your option) any later version. Chris@441: # Chris@0: # This program is distributed in the hope that it will be useful, Chris@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@0: # GNU General Public License for more details. Chris@441: # Chris@0: # You should have received a copy of the GNU General Public License Chris@0: # along with this program; if not, write to the Free Software Chris@0: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Chris@0: Chris@119: require File.expand_path('../../test_helper', __FILE__) Chris@0: Chris@0: class ProjectsControllerTest < ActionController::TestCase Chris@0: fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, Chris@0: :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages, Chris@0: :attachments, :custom_fields, :custom_values, :time_entries Chris@0: Chris@0: def setup Chris@0: @request.session[:user_id] = nil Chris@0: Setting.default_language = 'en' Chris@0: end Chris@441: Chris@1295: def test_index_by_anonymous_should_not_show_private_projects Chris@0: get :index Chris@0: assert_response :success Chris@0: assert_template 'index' Chris@1295: projects = assigns(:projects) Chris@1295: assert_not_nil projects Chris@1295: assert projects.all?(&:is_public?) Chris@441: Chris@1295: assert_select 'ul' do Chris@1295: assert_select 'li' do Chris@1295: assert_select 'a', :text => 'eCookbook' Chris@1295: assert_select 'ul' do Chris@1295: assert_select 'a', :text => 'Child of private child' Chris@1295: end Chris@1295: end Chris@1295: end Chris@1295: assert_select 'a', :text => /Private child of eCookbook/, :count => 0 Chris@0: end Chris@441: Chris@0: def test_index_atom Chris@0: get :index, :format => 'atom' Chris@0: assert_response :success Chris@1115: assert_template 'common/feed' Chris@0: assert_select 'feed>title', :text => 'Redmine: Latest projects' Chris@441: assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_condition(User.current)) Chris@0: end Chris@441: Chris@1295: test "#index by non-admin user with view_time_entries permission should show overall spent time link" do Chris@1295: @request.session[:user_id] = 3 Chris@1295: get :index Chris@1295: assert_template 'index' Chris@1295: assert_select 'a[href=?]', '/time_entries' Chris@1295: end Chris@441: Chris@1295: test "#index by non-admin user without view_time_entries permission should not show overall spent time link" do Chris@1295: Role.find(2).remove_permission! :view_time_entries Chris@1295: Role.non_member.remove_permission! :view_time_entries Chris@1295: Role.anonymous.remove_permission! :view_time_entries Chris@1295: @request.session[:user_id] = 3 Chris@1295: Chris@1295: get :index Chris@1295: assert_template 'index' Chris@1295: assert_select 'a[href=?]', '/time_entries', 0 Chris@1295: end Chris@1295: Chris@1295: test "#new by admin user should accept get" do Chris@1295: @request.session[:user_id] = 1 Chris@1295: Chris@1295: get :new Chris@1295: assert_response :success Chris@1295: assert_template 'new' Chris@1295: end Chris@1295: Chris@1295: test "#new by non-admin user with add_project permission should accept get" do Chris@1295: Role.non_member.add_permission! :add_project Chris@1295: @request.session[:user_id] = 9 Chris@1295: Chris@1295: get :new Chris@1295: assert_response :success Chris@1295: assert_template 'new' Chris@1295: assert_select 'select[name=?]', 'project[parent_id]', 0 Chris@1295: end Chris@1295: Chris@1295: test "#new by non-admin user with add_subprojects permission should accept get" do Chris@1295: Role.find(1).remove_permission! :add_project Chris@1295: Role.find(1).add_permission! :add_subprojects Chris@1295: @request.session[:user_id] = 2 Chris@1295: Chris@1295: get :new, :parent_id => 'ecookbook' Chris@1295: assert_response :success Chris@1295: assert_template 'new' Chris@1295: Chris@1295: assert_select 'select[name=?]', 'project[parent_id]' do Chris@1295: # parent project selected Chris@1295: assert_select 'option[value=1][selected=selected]' Chris@1295: # no empty value Chris@1295: assert_select 'option[value=]', 0 Chris@441: end Chris@0: end Chris@441: Chris@1295: test "#create by admin user should create a new project" do Chris@1295: @request.session[:user_id] = 1 Chris@441: Chris@1295: post :create, Chris@1295: :project => { Chris@1295: :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :homepage => 'http://weblog', Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :tracker_ids => ['1', '3'], Chris@1295: # an issue custom field that is not for all project Chris@1295: :issue_custom_field_ids => ['9'], Chris@1295: :enabled_module_names => ['issue_tracking', 'news', 'repository'] Chris@1295: } Chris@1295: assert_redirected_to '/projects/blog/settings' chris@22: Chris@1295: project = Project.find_by_name('blog') Chris@1295: assert_kind_of Project, project Chris@1295: assert project.active? Chris@1295: assert_equal 'weblog', project.description Chris@1295: assert_equal 'http://weblog', project.homepage Chris@1295: assert_equal true, project.is_public? Chris@1295: assert_nil project.parent Chris@1295: assert_equal 'Beta', project.custom_value_for(3).value Chris@1295: assert_equal [1, 3], project.trackers.map(&:id).sort Chris@1295: assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort Chris@1295: assert project.issue_custom_fields.include?(IssueCustomField.find(9)) Chris@1295: end Chris@1295: Chris@1295: test "#create by admin user should create a new subproject" do Chris@1295: @request.session[:user_id] = 1 Chris@1295: Chris@1295: assert_difference 'Project.count' do Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :parent_id => 1 Chris@1295: } Chris@1295: assert_redirected_to '/projects/blog/settings' chris@22: end chris@22: Chris@1295: project = Project.find_by_name('blog') Chris@1295: assert_kind_of Project, project Chris@1295: assert_equal Project.find(1), project.parent Chris@1295: end chris@22: Chris@1295: test "#create by admin user should continue" do Chris@1295: @request.session[:user_id] = 1 Chris@1295: Chris@1295: assert_difference 'Project.count' do Chris@1295: post :create, :project => {:name => "blog", :identifier => "blog"}, :continue => 'Create and continue' Chris@1295: end Chris@1295: assert_redirected_to '/projects/new' Chris@1295: end Chris@1295: Chris@1295: test "#create by non-admin user with add_project permission should create a new project" do Chris@1295: Role.non_member.add_permission! :add_project Chris@1295: @request.session[:user_id] = 9 Chris@1295: Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :tracker_ids => ['1', '3'], Chris@1295: :enabled_module_names => ['issue_tracking', 'news', 'repository'] Chris@1295: } Chris@1295: Chris@1295: assert_redirected_to '/projects/blog/settings' Chris@1295: Chris@1295: project = Project.find_by_name('blog') Chris@1295: assert_kind_of Project, project Chris@1295: assert_equal 'weblog', project.description Chris@1295: assert_equal true, project.is_public? Chris@1295: assert_equal [1, 3], project.trackers.map(&:id).sort Chris@1295: assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort Chris@1295: Chris@1295: # User should be added as a project member Chris@1295: assert User.find(9).member_of?(project) Chris@1295: assert_equal 1, project.members.size Chris@1295: end Chris@1295: Chris@1295: test "#create by non-admin user with add_project permission should fail with parent_id" do Chris@1295: Role.non_member.add_permission! :add_project Chris@1295: @request.session[:user_id] = 9 Chris@1295: Chris@1295: assert_no_difference 'Project.count' do Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :parent_id => 1 Chris@1295: } Chris@1295: end Chris@1295: assert_response :success Chris@1295: project = assigns(:project) Chris@1295: assert_kind_of Project, project Chris@1295: assert_not_nil project.errors[:parent_id] Chris@1295: end Chris@1295: Chris@1295: test "#create by non-admin user with add_subprojects permission should create a project with a parent_id" do Chris@1295: Role.find(1).remove_permission! :add_project Chris@1295: Role.find(1).add_permission! :add_subprojects Chris@1295: @request.session[:user_id] = 2 Chris@1295: Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :parent_id => 1 Chris@1295: } Chris@1295: assert_redirected_to '/projects/blog/settings' Chris@1295: project = Project.find_by_name('blog') Chris@1295: end Chris@1295: Chris@1295: test "#create by non-admin user with add_subprojects permission should fail without parent_id" do Chris@1295: Role.find(1).remove_permission! :add_project Chris@1295: Role.find(1).add_permission! :add_subprojects Chris@1295: @request.session[:user_id] = 2 Chris@1295: Chris@1295: assert_no_difference 'Project.count' do Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' } Chris@1295: } Chris@1295: end Chris@1295: assert_response :success Chris@1295: project = assigns(:project) Chris@1295: assert_kind_of Project, project Chris@1295: assert_not_nil project.errors[:parent_id] Chris@1295: end Chris@1295: Chris@1295: test "#create by non-admin user with add_subprojects permission should fail with unauthorized parent_id" do Chris@1295: Role.find(1).remove_permission! :add_project Chris@1295: Role.find(1).add_permission! :add_subprojects Chris@1295: @request.session[:user_id] = 2 Chris@1295: Chris@1295: assert !User.find(2).member_of?(Project.find(6)) Chris@1295: assert_no_difference 'Project.count' do Chris@1295: post :create, :project => { :name => "blog", Chris@1295: :description => "weblog", Chris@1295: :identifier => "blog", Chris@1295: :is_public => 1, Chris@1295: :custom_field_values => { '3' => 'Beta' }, Chris@1295: :parent_id => 6 Chris@1295: } Chris@1295: end Chris@1295: assert_response :success Chris@1295: project = assigns(:project) Chris@1295: assert_kind_of Project, project Chris@1295: assert_not_nil project.errors[:parent_id] Chris@1295: end Chris@1295: Chris@1295: def test_create_subproject_with_inherit_members_should_inherit_members Chris@1295: Role.find_by_name('Manager').add_permission! :add_subprojects Chris@1295: parent = Project.find(1) Chris@1295: @request.session[:user_id] = 2 Chris@1295: Chris@1295: assert_difference 'Project.count' do Chris@1295: post :create, :project => { Chris@1295: :name => 'inherited', :identifier => 'inherited', :parent_id => parent.id, :inherit_members => '1' Chris@1295: } Chris@1295: assert_response 302 chris@22: end chris@22: Chris@1295: project = Project.order('id desc').first Chris@1295: assert_equal 'inherited', project.name Chris@1295: assert_equal parent, project.parent Chris@1295: assert project.memberships.count > 0 Chris@1295: assert_equal parent.memberships.count, project.memberships.count Chris@0: end Chris@441: Chris@441: def test_create_should_preserve_modules_on_validation_failure Chris@441: with_settings :default_projects_modules => ['issue_tracking', 'repository'] do Chris@441: @request.session[:user_id] = 1 Chris@441: assert_no_difference 'Project.count' do Chris@441: post :create, :project => { Chris@441: :name => "blog", Chris@441: :identifier => "", Chris@441: :enabled_module_names => %w(issue_tracking news) Chris@441: } Chris@441: end Chris@441: assert_response :success Chris@441: project = assigns(:project) Chris@441: assert_equal %w(issue_tracking news), project.enabled_module_names.sort Chris@441: end Chris@441: end Chris@441: Chris@0: def test_show_by_id Chris@0: get :show, :id => 1 Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@0: assert_not_nil assigns(:project) Chris@0: end Chris@0: Chris@0: def test_show_by_identifier Chris@0: get :show, :id => 'ecookbook' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@0: assert_not_nil assigns(:project) Chris@0: assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) Chris@441: Chris@1295: assert_select 'li', :text => /Development status/ chris@37: end chris@37: chris@37: def test_show_should_not_display_hidden_custom_fields chris@37: ProjectCustomField.find_by_name('Development status').update_attribute :visible, false chris@37: get :show, :id => 'ecookbook' chris@37: assert_response :success chris@37: assert_template 'show' chris@37: assert_not_nil assigns(:project) Chris@441: Chris@1295: assert_select 'li', :text => /Development status/, :count => 0 Chris@0: end Chris@441: Chris@0: def test_show_should_not_fail_when_custom_values_are_nil Chris@0: project = Project.find_by_identifier('ecookbook') Chris@0: project.custom_values.first.update_attribute(:value, nil) Chris@0: get :show, :id => 'ecookbook' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@0: assert_not_nil assigns(:project) Chris@0: assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) Chris@0: end Chris@441: chris@37: def show_archived_project_should_be_denied chris@37: project = Project.find_by_identifier('ecookbook') chris@37: project.archive! Chris@441: chris@37: get :show, :id => 'ecookbook' chris@37: assert_response 403 chris@37: assert_nil assigns(:project) Chris@1295: assert_select 'p', :text => /archived/ chris@37: end Chris@441: Chris@1295: def test_show_should_not_show_private_subprojects_that_are_not_visible Chris@0: get :show, :id => 'ecookbook' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@1295: assert_select 'a', :text => /Private child/, :count => 0 Chris@0: end Chris@0: Chris@1295: def test_show_should_show_private_subprojects_that_are_visible Chris@0: @request.session[:user_id] = 2 # manager who is a member of the private subproject Chris@0: get :show, :id => 'ecookbook' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@1295: assert_select 'a', :text => /Private child/ Chris@0: end Chris@441: Chris@0: def test_settings Chris@0: @request.session[:user_id] = 2 # manager Chris@0: get :settings, :id => 1 Chris@0: assert_response :success Chris@0: assert_template 'settings' Chris@0: end Chris@441: Chris@1295: def test_settings_of_subproject Chris@1295: @request.session[:user_id] = 2 Chris@1295: get :settings, :id => 'private-child' Chris@1295: assert_response :success Chris@1295: assert_template 'settings' Chris@1295: Chris@1295: assert_select 'input[type=checkbox][name=?]', 'project[inherit_members]' Chris@1295: end Chris@1295: Chris@1115: def test_settings_should_be_denied_for_member_on_closed_project Chris@1115: Project.find(1).close Chris@1115: @request.session[:user_id] = 2 # manager Chris@1115: Chris@1115: get :settings, :id => 1 Chris@1115: assert_response 403 Chris@1115: end Chris@1115: Chris@1115: def test_settings_should_be_denied_for_anonymous_on_closed_project Chris@1115: Project.find(1).close Chris@1115: Chris@1115: get :settings, :id => 1 Chris@1115: assert_response 302 Chris@1115: end Chris@1115: chris@22: def test_update Chris@0: @request.session[:user_id] = 2 # manager chris@22: post :update, :id => 1, :project => {:name => 'Test changed name', Chris@0: :issue_custom_field_ids => ['']} chris@37: assert_redirected_to '/projects/ecookbook/settings' Chris@0: project = Project.find(1) Chris@0: assert_equal 'Test changed name', project.name Chris@0: end Chris@119: Chris@1115: def test_update_with_failure Chris@1115: @request.session[:user_id] = 2 # manager Chris@1115: post :update, :id => 1, :project => {:name => ''} Chris@1115: assert_response :success Chris@1115: assert_template 'settings' Chris@1115: assert_error_tag :content => /name can't be blank/i Chris@1115: end Chris@1115: Chris@1115: def test_update_should_be_denied_for_member_on_closed_project Chris@1115: Project.find(1).close Chris@1115: @request.session[:user_id] = 2 # manager Chris@1115: Chris@1115: post :update, :id => 1, :project => {:name => 'Closed'} Chris@1115: assert_response 403 Chris@1115: assert_equal 'eCookbook', Project.find(1).name Chris@1115: end Chris@1115: Chris@1115: def test_update_should_be_denied_for_anonymous_on_closed_project Chris@1115: Project.find(1).close Chris@1115: Chris@1115: post :update, :id => 1, :project => {:name => 'Closed'} Chris@1115: assert_response 302 Chris@1115: assert_equal 'eCookbook', Project.find(1).name Chris@1115: end Chris@1115: Chris@119: def test_modules Chris@119: @request.session[:user_id] = 2 Chris@119: Project.find(1).enabled_module_names = ['issue_tracking', 'news'] Chris@441: Chris@119: post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents'] Chris@119: assert_redirected_to '/projects/ecookbook/settings/modules' Chris@119: assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort Chris@119: end Chris@119: Chris@1295: def test_destroy_leaf_project_without_confirmation_should_show_confirmation Chris@0: @request.session[:user_id] = 1 # admin Chris@1295: Chris@1295: assert_no_difference 'Project.count' do Chris@1295: delete :destroy, :id => 2 Chris@1295: assert_response :success Chris@1295: assert_template 'destroy' Chris@1295: end Chris@1295: end Chris@1295: Chris@1295: def test_destroy_without_confirmation_should_show_confirmation_with_subprojects Chris@1295: @request.session[:user_id] = 1 # admin Chris@1295: Chris@1295: assert_no_difference 'Project.count' do Chris@1295: delete :destroy, :id => 1 Chris@1295: assert_response :success Chris@1295: assert_template 'destroy' Chris@1295: end Chris@1295: assert_select 'strong', Chris@1295: :text => ['Private child of eCookbook', Chris@1115: 'Child of private child, eCookbook Subproject 1', Chris@1115: 'eCookbook Subproject 2'].join(', ') Chris@0: end Chris@0: Chris@1295: def test_destroy_with_confirmation_should_destroy_the_project_and_subprojects Chris@0: @request.session[:user_id] = 1 # admin Chris@1295: Chris@1295: assert_difference 'Project.count', -5 do Chris@1295: delete :destroy, :id => 1, :confirm => 1 Chris@1295: assert_redirected_to '/admin/projects' Chris@1295: end Chris@0: assert_nil Project.find_by_id(1) Chris@0: end Chris@441: Chris@0: def test_archive Chris@0: @request.session[:user_id] = 1 # admin Chris@0: post :archive, :id => 1 chris@37: assert_redirected_to '/admin/projects' Chris@0: assert !Project.find(1).active? Chris@0: end Chris@441: Chris@1115: def test_archive_with_failure Chris@1115: @request.session[:user_id] = 1 Chris@1115: Project.any_instance.stubs(:archive).returns(false) Chris@1115: post :archive, :id => 1 Chris@1115: assert_redirected_to '/admin/projects' Chris@1115: assert_match /project cannot be archived/i, flash[:error] Chris@1115: end Chris@1115: Chris@0: def test_unarchive Chris@0: @request.session[:user_id] = 1 # admin Chris@0: Project.find(1).archive Chris@0: post :unarchive, :id => 1 chris@37: assert_redirected_to '/admin/projects' Chris@0: assert Project.find(1).active? Chris@0: end Chris@441: Chris@1115: def test_close Chris@1115: @request.session[:user_id] = 2 Chris@1115: post :close, :id => 1 Chris@1115: assert_redirected_to '/projects/ecookbook' Chris@1115: assert_equal Project::STATUS_CLOSED, Project.find(1).status Chris@1115: end Chris@1115: Chris@1115: def test_reopen Chris@1115: Project.find(1).close Chris@1115: @request.session[:user_id] = 2 Chris@1115: post :reopen, :id => 1 Chris@1115: assert_redirected_to '/projects/ecookbook' Chris@1115: assert Project.find(1).active? Chris@1115: end Chris@1115: Chris@0: def test_project_breadcrumbs_should_be_limited_to_3_ancestors Chris@0: CustomField.delete_all Chris@0: parent = nil Chris@0: 6.times do |i| Chris@1295: p = Project.generate_with_parent!(parent) Chris@0: get :show, :id => p Chris@1295: assert_select '#header h1' do Chris@1295: assert_select 'a', :count => [i, 3].min Chris@1295: end Chris@441: Chris@0: parent = p Chris@0: end Chris@0: end Chris@0: Chris@441: def test_get_copy Chris@0: @request.session[:user_id] = 1 # admin Chris@0: get :copy, :id => 1 Chris@0: assert_response :success Chris@0: assert_template 'copy' Chris@0: assert assigns(:project) Chris@0: assert_equal Project.find(1).description, assigns(:project).description Chris@0: assert_nil assigns(:project).id Chris@441: Chris@1295: assert_select 'input[name=?][value=?]', 'project[enabled_module_names][]', 'issue_tracking', 1 Chris@0: end Chris@0: Chris@1115: def test_get_copy_with_invalid_source_should_respond_with_404 Chris@1115: @request.session[:user_id] = 1 Chris@1115: get :copy, :id => 99 Chris@1115: assert_response 404 Chris@0: end Chris@0: Chris@441: def test_post_copy_should_copy_requested_items Chris@441: @request.session[:user_id] = 1 # admin Chris@441: CustomField.delete_all chris@37: Chris@441: assert_difference 'Project.count' do Chris@441: post :copy, :id => 1, Chris@441: :project => { Chris@441: :name => 'Copy', Chris@441: :identifier => 'unique-copy', Chris@441: :tracker_ids => ['1', '2', '3', ''], Chris@441: :enabled_module_names => %w(issue_tracking time_tracking) Chris@441: }, Chris@441: :only => %w(issues versions) chris@37: end Chris@441: project = Project.find('unique-copy') Chris@441: source = Project.find(1) Chris@441: assert_equal %w(issue_tracking time_tracking), project.enabled_module_names.sort Chris@441: Chris@441: assert_equal source.versions.count, project.versions.count, "All versions were not copied" Chris@1115: assert_equal source.issues.count, project.issues.count, "All issues were not copied" Chris@441: assert_equal 0, project.members.count Chris@441: end Chris@441: Chris@441: def test_post_copy_should_redirect_to_settings_when_successful Chris@441: @request.session[:user_id] = 1 # admin Chris@441: post :copy, :id => 1, :project => {:name => 'Copy', :identifier => 'unique-copy'} Chris@441: assert_response :redirect Chris@441: assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'unique-copy' chris@37: end chris@37: Chris@0: def test_jump_should_redirect_to_active_tab Chris@0: get :show, :id => 1, :jump => 'issues' chris@37: assert_redirected_to '/projects/ecookbook/issues' Chris@0: end Chris@441: Chris@0: def test_jump_should_not_redirect_to_inactive_tab Chris@0: get :show, :id => 3, :jump => 'documents' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@0: end Chris@441: Chris@0: def test_jump_should_not_redirect_to_unknown_tab Chris@0: get :show, :id => 3, :jump => 'foobar' Chris@0: assert_response :success Chris@0: assert_template 'show' Chris@0: end Chris@0: end