##// END OF EJS Templates
Added request and controller objects to the hooks by default....
Added request and controller objects to the hooks by default. The request and controller objects are now added to all hook contexts by default. This will also make url_for work better in hooks by setting up the default_url_options :host, :port, and :protocol. Finally a new helper method @render_or@ has been added to ViewListener. This will let a hook easily render a partial without a full method definition. Thanks to Thomas Löber for the original patch. #2542 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2429 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2315:765f7abc6033
r2368:5b7a5c39a7da
Show More
admin_test.rb
66 lines | 2.6 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
v0.2.0...
r5 # redMine - project management software
# Copyright (C) 2006 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require "#{File.dirname(__FILE__)}/../test_helper"
class AdminTest < ActionController::IntegrationTest
fixtures :users
def test_add_user
log_user("admin", "admin")
get "/users/add"
assert_response :success
assert_template "users/add"
Jean-Philippe Lang
0.3 unstable...
r10 post "/users/add", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
Jean-Philippe Lang
v0.2.0...
r5 assert_redirected_to "users/list"
Jean-Philippe Lang
0.3 unstable...
r10 user = User.find_by_login("psmith")
Jean-Philippe Lang
v0.2.0...
r5 assert_kind_of User, user
Jean-Philippe Lang
0.3 unstable...
r10 logged_user = User.try_to_login("psmith", "psmith09")
Jean-Philippe Lang
v0.2.0...
r5 assert_kind_of User, logged_user
Jean-Philippe Lang
0.3 unstable...
r10 assert_equal "Paul", logged_user.firstname
Jean-Philippe Lang
v0.2.0...
r5
Jean-Philippe Lang
0.3 unstable...
r10 post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
Jean-Philippe Lang
v0.2.0...
r5 assert_redirected_to "users/list"
Jean-Philippe Lang
0.3 unstable...
r10 locked_user = User.try_to_login("psmith", "psmith09")
Jean-Philippe Lang
v0.2.0...
r5 assert_equal nil, locked_user
end
def test_add_project
log_user("admin", "admin")
Eric Davis
Converted routing and urls to follow the Rails REST convention....
r2315 get "projects/new"
Jean-Philippe Lang
v0.2.0...
r5 assert_response :success
assert_template "projects/add"
Eric Davis
Converted routing and urls to follow the Rails REST convention....
r2315 post "projects", :project => { :name => "blog",
Jean-Philippe Lang
Fix: error when posting to projects/add or users/add with no custom_fields parameter....
r664 :description => "weblog",
:identifier => "blog",
Jean-Philippe Lang
Custom fields refactoring: most of code moved from controllers to models (using new module ActsAsCustomizable)....
r1578 :is_public => 1,
:custom_field_values => { '3' => 'Beta' }
}
Jean-Philippe Lang
v0.2.0...
r5 assert_redirected_to "admin/projects"
Jean-Philippe Lang
notice messages translation...
r15 assert_equal 'Successful creation.', flash[:notice]
Jean-Philippe Lang
v0.2.0...
r5
project = Project.find_by_name("blog")
assert_kind_of Project, project
Jean-Philippe Lang
0.3 unstable...
r10 assert_equal "weblog", project.description
Jean-Philippe Lang
v0.2.0...
r5 assert_equal true, project.is_public?
get "admin/projects"
assert_response :success
assert_template "admin/projects"
end
end