assert existing_user.save!
post :login, :openid_url => existing_user.identity_url
- assert_redirected_to 'my/page'
+ assert_redirected_to '/my/page'
end
def test_login_with_invalid_openid_provider
assert existing_user.save!
post :login, :openid_url => existing_user.identity_url
- assert_redirected_to 'login'
+ assert_redirected_to '/login'
end
def test_login_with_openid_with_new_user_created
Setting.self_registration = '3'
Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
- assert_redirected_to 'my/account'
+ assert_redirected_to '/my/account'
user = User.find_by_login('cool_user')
assert user
assert_equal 'Cool', user.firstname
Setting.self_registration = '1'
Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
- assert_redirected_to 'login'
+ assert_redirected_to '/login'
user = User.find_by_login('cool_user')
assert user
Setting.self_registration = '2'
Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
- assert_redirected_to 'login'
+ assert_redirected_to '/login'
user = User.find_by_login('cool_user')
assert user
assert_equal User::STATUS_REGISTERED, user.status
def test_logout
@request.session[:user_id] = 2
get :logout
- assert_redirected_to ''
+ assert_redirected_to '/'
assert_nil @request.session[:user_id]
end
post :destroy, :id => 1
end
# no referrer
- assert_redirected_to 'projects/ecookbook'
+ assert_redirected_to '/projects/ecookbook'
assert_nil Attachment.find_by_id(1)
j = issue.journals.find(:first, :order => 'created_on DESC')
assert_equal 'attachment', j.details.first.property
def test_add_comment
@request.session[:user_id] = 2
post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
- assert_redirected_to 'news/1'
+ assert_redirected_to '/news/1'
comment = News.find(1).comments.find(:first, :order => 'created_on DESC')
assert_not_nil comment
assert_no_difference 'Comment.count' do
post :create, :id => 1, :comment => { :comments => '' }
assert_response :redirect
- assert_redirected_to 'news/1'
+ assert_redirected_to '/news/1'
end
end
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
delete :destroy, :id => 1, :comment_id => 2
- assert_redirected_to 'news/1'
+ assert_redirected_to '/news/1'
assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
end
:category_id => 2},
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
- assert_redirected_to 'projects/ecookbook/documents'
+ assert_redirected_to '/projects/ecookbook/documents'
document = Document.find_by_title('DocumentsControllerTest#test_post_new')
assert_not_nil document
def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1
- assert_redirected_to 'projects/ecookbook/documents'
+ assert_redirected_to '/projects/ecookbook/documents'
assert_nil Document.find_by_id(1)
end
end
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_response :redirect
end
- assert_redirected_to 'projects/ecookbook/files'
+ assert_redirected_to '/projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
assert_equal 'testfile.txt', a.filename
assert_equal Project.find(1), a.container
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_response :redirect
end
- assert_redirected_to 'projects/ecookbook/files'
+ assert_redirected_to '/projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
assert_equal 'testfile.txt', a.filename
assert_equal Version.find(2), a.container
assert_difference 'Group.count' do
post :create, :group => {:lastname => 'New group'}
end
- assert_redirected_to 'groups'
+ assert_redirected_to '/groups'
end
def test_edit
def test_update
post :update, :id => 10
- assert_redirected_to 'groups'
+ assert_redirected_to '/groups'
end
def test_destroy
assert_difference 'Group.count', -1 do
post :destroy, :id => 10
end
- assert_redirected_to 'groups'
+ assert_redirected_to '/groups'
end
def test_add_users
post :create, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}
end
end
- assert_redirected_to 'projects/ecookbook/issues'
+ assert_redirected_to '/projects/ecookbook/issues'
end
context "#create via bulk copy" do
:content => 'Message body'}
message = Message.find_by_subject('Test created message')
assert_not_nil message
- assert_redirected_to "boards/1/topics/#{message.to_param}"
+ assert_redirected_to "/boards/1/topics/#{message.to_param}"
assert_equal 'Message body', message.content
assert_equal 2, message.author_id
assert_equal 1, message.board_id
post :edit, :board_id => 1, :id => 1,
:message => { :subject => 'New subject',
:content => 'New body'}
- assert_redirected_to 'boards/1/topics/1'
+ assert_redirected_to '/boards/1/topics/1'
message = Message.find(1)
assert_equal 'New subject', message.subject
assert_equal 'New body', message.content
@request.session[:user_id] = 2
post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' }
reply = Message.find(:first, :order => 'id DESC')
- assert_redirected_to "boards/1/topics/1?r=#{reply.id}"
+ assert_redirected_to "/boards/1/topics/1?r=#{reply.id}"
assert Message.find_by_subject('Test reply')
end
def test_destroy_topic
@request.session[:user_id] = 2
post :destroy, :board_id => 1, :id => 1
- assert_redirected_to 'projects/ecookbook/boards/1'
+ assert_redirected_to '/projects/ecookbook/boards/1'
assert_nil Message.find_by_id(1)
end
:login => "root",
:admin => 1,
:custom_field_values => {"4" => "0100562500"}}
- assert_redirected_to 'my/account'
+ assert_redirected_to '/my/account'
user = User.find(2)
assert_equal user, assigns(:user)
assert_equal "Joe", user.firstname
post :password, :password => 'jsmith',
:new_password => 'hello',
:new_password_confirmation => 'hello'
- assert_redirected_to 'my/account'
+ assert_redirected_to '/my/account'
assert User.try_to_login('jsmith', 'hello')
end
post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
:description => 'This is the description',
:summary => '' }
- assert_redirected_to 'projects/ecookbook/news'
+ assert_redirected_to '/projects/ecookbook/news'
news = News.find_by_title('NewsControllerTest')
assert_not_nil news
def test_put_update
@request.session[:user_id] = 2
put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' }
- assert_redirected_to 'news/1'
+ assert_redirected_to '/news/1'
news = News.find(1)
assert_equal 'Description changed by test_post_edit', news.description
end
def test_destroy
@request.session[:user_id] = 2
delete :destroy, :id => 1
- assert_redirected_to 'projects/ecookbook/news'
+ assert_redirected_to '/projects/ecookbook/news'
assert_nil News.find_by_id(1)
end
end
}
assert_response :redirect
- assert_redirected_to 'projects/ecookbook/settings/activities'
+ assert_redirected_to '/projects/ecookbook/settings/activities'
# Created project specific activities...
project = Project.find('ecookbook')
}
assert_response :redirect
- assert_redirected_to 'projects/ecookbook/settings/activities'
+ assert_redirected_to '/projects/ecookbook/settings/activities'
# Created project specific activities...
project = Project.find('ecookbook')
delete :destroy, :project_id => 1
assert_response :redirect
- assert_redirected_to 'projects/ecookbook/settings/activities'
+ assert_redirected_to '/projects/ecookbook/settings/activities'
assert_nil TimeEntryActivity.find_by_id(project_activity.id)
assert_nil TimeEntryActivity.find_by_id(project_activity_two.id)
delete :destroy, :project_id => 1
assert_response :redirect
- assert_redirected_to 'projects/ecookbook/settings/activities'
+ assert_redirected_to '/projects/ecookbook/settings/activities'
assert_nil TimeEntryActivity.find_by_id(project_activity.id)
assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size, "TimeEntries still assigned to project specific activity"
@request.session[:user_id] = 2 # manager
post :update, :id => 1, :project => {:name => 'Test changed name',
:issue_custom_field_ids => ['']}
- assert_redirected_to 'projects/ecookbook/settings'
+ assert_redirected_to '/projects/ecookbook/settings'
project = Project.find(1)
assert_equal 'Test changed name', project.name
end
def test_post_destroy
@request.session[:user_id] = 1 # admin
post :destroy, :id => 1, :confirm => 1
- assert_redirected_to 'admin/projects'
+ assert_redirected_to '/admin/projects'
assert_nil Project.find_by_id(1)
end
def test_archive
@request.session[:user_id] = 1 # admin
post :archive, :id => 1
- assert_redirected_to 'admin/projects'
+ assert_redirected_to '/admin/projects'
assert !Project.find(1).active?
end
@request.session[:user_id] = 1 # admin
Project.find(1).archive
post :unarchive, :id => 1
- assert_redirected_to 'admin/projects'
+ assert_redirected_to '/admin/projects'
assert Project.find(1).active?
end
def test_jump_should_redirect_to_active_tab
get :show, :id => 1, :jump => 'issues'
- assert_redirected_to 'projects/ecookbook/issues'
+ assert_redirected_to '/projects/ecookbook/issues'
end
def test_jump_should_not_redirect_to_inactive_tab
assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
- assert_redirected_to 'projects/ecookbook/repository/committers'
+ assert_redirected_to '/projects/ecookbook/repository/committers'
assert_equal User.find(2), c.reload.user
end
end
:permissions => ['add_issues', 'edit_issues', 'log_time', ''],
:assignable => '0'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
role = Role.find_by_name('RoleWithoutWorkflowCopy')
assert_not_nil role
assert_equal [:add_issues, :edit_issues, :log_time], role.permissions
:assignable => '0'},
:copy_workflow_from => '1'
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
role = Role.find_by_name('RoleWithWorkflowCopy')
assert_not_nil role
assert_equal Role.find(1).workflows.size, role.workflows.size
:permissions => ['edit_project', ''],
:assignable => '0'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
role = Role.find(1)
assert_equal [:edit_project], role.permissions
end
assert r.save
post :destroy, :id => r
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_nil Role.find_by_id(r.id)
end
def test_destroy_role_in_use
post :destroy, :id => 1
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert flash[:error] == 'This role is in use and can not be deleted.'
assert_not_nil Role.find_by_id(1)
end
def test_post_report
post :report, :permissions => { '0' => '', '1' => ['edit_issues'], '3' => ['add_issues', 'delete_issues']}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_equal [:edit_issues], Role.find(1).permissions
assert_equal [:add_issues, :delete_issues], Role.find(3).permissions
def test_clear_all_permissions
post :report, :permissions => { '0' => '' }
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert Role.find(1).permissions.empty?
end
def test_move_highest
post :edit, :id => 3, :role => {:move_to => 'highest'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_equal 1, Role.find(3).position
end
def test_move_higher
position = Role.find(3).position
post :edit, :id => 3, :role => {:move_to => 'higher'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_equal position - 1, Role.find(3).position
end
def test_move_lower
position = Role.find(2).position
post :edit, :id => 2, :role => {:move_to => 'lower'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_equal position + 1, Role.find(2).position
end
def test_move_lowest
post :edit, :id => 2, :role => {:move_to => 'lowest'}
- assert_redirected_to 'roles'
+ assert_redirected_to '/roles'
assert_equal Role.count, Role.find(2).position
end
end
def test_quick_jump_to_issue
# issue of a public project
get :index, :q => "3"
- assert_redirected_to 'issues/3'
+ assert_redirected_to '/issues/3'
# issue of a private project
get :index, :q => "4"
:notified_events => %w(issue_added issue_updated news_added),
:emails_footer => 'Test footer'
}
- assert_redirected_to 'settings/edit'
+ assert_redirected_to '/settings/edit'
assert_equal 'functional@test.foo', Setting.mail_from
assert !Setting.bcc_recipients?
assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
# User logs in with 'autologin' checked
post '/login', :username => user.login, :password => 'admin', :autologin => 1
- assert_redirected_to 'my/page'
+ assert_redirected_to '/my/page'
token = Token.find :first
assert_not_nil token
assert_equal user, token.user
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
:password => "newpass", :password_confirmation => "newpass"
- assert_redirected_to 'my/account'
+ assert_redirected_to '/my/account'
follow_redirect!
assert_response :success
assert_template 'my/account'
AuthSource.expects(:authenticate).returns({:login => 'foo', :firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com', :auth_source_id => 66})
post 'account/login', :username => 'foo', :password => 'bar'
- assert_redirected_to 'my/page'
+ assert_redirected_to '/my/page'
user = User.find_by_login('foo')
assert user.is_a?(User)
sid = session[:session_id]
post '/login', :username => 'admin', :password => 'admin'
- assert_redirected_to 'my/page'
+ assert_redirected_to '/my/page'
assert_not_equal sid, session[:session_id], "login should reset session"
assert_equal 1, session[:user_id]
sid = session[:session_id]
put 'issues/1',
:notes => 'Some notes',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
- assert_redirected_to "issues/1"
+ assert_redirected_to "/issues/1"
# make sure attachment was saved
attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
assert_response :success
assert_template "admin/projects"
post "projects/archive", :id => 1
- assert_redirected_to "admin/projects"
+ assert_redirected_to "/admin/projects"
assert !Project.find(1).active?
get 'projects/1'
assert_response 403
post "projects/unarchive", :id => 1
- assert_redirected_to "admin/projects"
+ assert_redirected_to "/admin/projects"
assert Project.find(1).active?
get "projects/1"
assert_response :success