1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 ENV["RAILS_ENV"] ||= "test"
19 require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
21 require File.expand_path(File.dirname(__FILE__) + '/helper_testcase')
23 class Test::Unit::TestCase
24 # Transactional fixtures accelerate your tests by wrapping each test method
25 # in a transaction that's rolled back on completion. This ensures that the
26 # test database remains unchanged so your fixtures don't have to be reloaded
27 # between every test method. Fewer database queries means faster tests.
29 # Read Mike Clark's excellent walkthrough at
30 # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
32 # Every Active Record database supports transactions except MyISAM tables
33 # in MySQL. Turn off transactional fixtures in this case; however, if you
34 # don't care one way or the other, switching from MyISAM to InnoDB tables
36 self.use_transactional_fixtures = true
38 # Instantiated fixtures are slow, but give you @david where otherwise you
39 # would need people(:david). If you don't want to migrate your existing
40 # test cases which use the @david style and don't mind the speed hit (each
41 # instantiated fixtures translates to a database query per test method),
42 # then set this back to true.
43 self.use_instantiated_fixtures = false
45 # Add more helper methods to be used by all tests here...
47 def log_user(login, password)
49 assert_equal nil, session[:user_id]
50 assert_response :success
51 assert_template "account/login"
52 post "/account/login", :login => login, :password => password
53 assert_redirected_to "my/page"
54 assert_equal login, User.find(session[:user_id]).login
59 # ActionController::TestUploadedFile bug
60 # see http://dev.rubyonrails.org/ticket/4635