1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,73 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
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. | |||
|
8 | # | |||
|
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. | |||
|
13 | # | |||
|
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. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | require 'account_controller' | |||
|
20 | ||||
|
21 | # Re-raise errors caught by the controller. | |||
|
22 | class AccountController; def rescue_action(e) raise e end; end | |||
|
23 | ||||
|
24 | class AccountControllerTest < Test::Unit::TestCase | |||
|
25 | fixtures :users | |||
|
26 | ||||
|
27 | def setup | |||
|
28 | @controller = AccountController.new | |||
|
29 | @request = ActionController::TestRequest.new | |||
|
30 | @response = ActionController::TestResponse.new | |||
|
31 | User.current = nil | |||
|
32 | end | |||
|
33 | ||||
|
34 | def test_show | |||
|
35 | get :show, :id => 2 | |||
|
36 | assert_response :success | |||
|
37 | assert_template 'show' | |||
|
38 | assert_not_nil assigns(:user) | |||
|
39 | end | |||
|
40 | ||||
|
41 | def test_show_inactive | |||
|
42 | get :show, :id => 5 | |||
|
43 | assert_response 404 | |||
|
44 | assert_nil assigns(:user) | |||
|
45 | end | |||
|
46 | ||||
|
47 | def test_login_with_wrong_password | |||
|
48 | post :login, :login => 'admin', :password => 'bad' | |||
|
49 | assert_response :success | |||
|
50 | assert_template 'login' | |||
|
51 | assert_tag 'div', | |||
|
52 | :attributes => { :class => "flash error" }, | |||
|
53 | :content => /Invalid user or password/ | |||
|
54 | end | |||
|
55 | ||||
|
56 | def test_autologin | |||
|
57 | Setting.autologin = "7" | |||
|
58 | Token.delete_all | |||
|
59 | post :login, :login => 'admin', :password => 'admin', :autologin => 1 | |||
|
60 | assert_redirected_to 'my/page' | |||
|
61 | token = Token.find :first | |||
|
62 | assert_not_nil token | |||
|
63 | assert_equal User.find_by_login('admin'), token.user | |||
|
64 | assert_equal 'autologin', token.action | |||
|
65 | end | |||
|
66 | ||||
|
67 | def test_logout | |||
|
68 | @request.session[:user_id] = 2 | |||
|
69 | get :logout | |||
|
70 | assert_redirected_to '' | |||
|
71 | assert_nil @request.session[:user_id] | |||
|
72 | end | |||
|
73 | end |
@@ -0,0 +1,61 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
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. | |||
|
8 | # | |||
|
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. | |||
|
13 | # | |||
|
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. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | require 'admin_controller' | |||
|
20 | ||||
|
21 | # Re-raise errors caught by the controller. | |||
|
22 | class AdminController; def rescue_action(e) raise e end; end | |||
|
23 | ||||
|
24 | class AdminControllerTest < Test::Unit::TestCase | |||
|
25 | fixtures :projects, :users | |||
|
26 | ||||
|
27 | def setup | |||
|
28 | @controller = AdminController.new | |||
|
29 | @request = ActionController::TestRequest.new | |||
|
30 | @response = ActionController::TestResponse.new | |||
|
31 | User.current = nil | |||
|
32 | @request.session[:user_id] = 1 # admin | |||
|
33 | end | |||
|
34 | ||||
|
35 | def test_get_mail_options | |||
|
36 | get :mail_options | |||
|
37 | assert_response :success | |||
|
38 | assert_template 'mail_options' | |||
|
39 | end | |||
|
40 | ||||
|
41 | def test_post_mail_options | |||
|
42 | post :mail_options, :settings => {'mail_from' => 'functional@test.foo'} | |||
|
43 | assert_redirected_to 'admin/mail_options' | |||
|
44 | assert_equal 'functional@test.foo', Setting.mail_from | |||
|
45 | end | |||
|
46 | ||||
|
47 | def test_test_email | |||
|
48 | get :test_email | |||
|
49 | assert_redirected_to 'admin/mail_options' | |||
|
50 | mail = ActionMailer::Base.deliveries.last | |||
|
51 | assert_kind_of TMail::Mail, mail | |||
|
52 | user = User.find(1) | |||
|
53 | assert_equal [user.mail], mail.bcc | |||
|
54 | end | |||
|
55 | ||||
|
56 | def test_info | |||
|
57 | get :info | |||
|
58 | assert_response :success | |||
|
59 | assert_template 'info' | |||
|
60 | end | |||
|
61 | end |
@@ -0,0 +1,62 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
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. | |||
|
8 | # | |||
|
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. | |||
|
13 | # | |||
|
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. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | require 'users_controller' | |||
|
20 | ||||
|
21 | # Re-raise errors caught by the controller. | |||
|
22 | class UsersController; def rescue_action(e) raise e end; end | |||
|
23 | ||||
|
24 | class UsersControllerTest < Test::Unit::TestCase | |||
|
25 | fixtures :users, :projects, :members | |||
|
26 | ||||
|
27 | def setup | |||
|
28 | @controller = UsersController.new | |||
|
29 | @request = ActionController::TestRequest.new | |||
|
30 | @response = ActionController::TestResponse.new | |||
|
31 | User.current = nil | |||
|
32 | @request.session[:user_id] = 1 # admin | |||
|
33 | end | |||
|
34 | ||||
|
35 | def test_index | |||
|
36 | get :index | |||
|
37 | assert_response :success | |||
|
38 | assert_template 'list' | |||
|
39 | end | |||
|
40 | ||||
|
41 | def test_list | |||
|
42 | get :list | |||
|
43 | assert_response :success | |||
|
44 | assert_template 'list' | |||
|
45 | assert_not_nil assigns(:users) | |||
|
46 | # active users only | |||
|
47 | assert_nil assigns(:users).detect {|u| !u.active?} | |||
|
48 | end | |||
|
49 | ||||
|
50 | def test_edit_membership | |||
|
51 | post :edit_membership, :id => 2, :membership_id => 1, | |||
|
52 | :membership => { :role_id => 2} | |||
|
53 | assert_redirected_to 'users/edit/2' | |||
|
54 | assert_equal 2, Member.find(1).role_id | |||
|
55 | end | |||
|
56 | ||||
|
57 | def test_destroy_membership | |||
|
58 | post :destroy_membership, :id => 2, :membership_id => 1 | |||
|
59 | assert_redirected_to 'users/edit/2' | |||
|
60 | assert_nil Member.find_by_id(1) | |||
|
61 | end | |||
|
62 | end |
@@ -0,0 +1,49 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
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. | |||
|
8 | # | |||
|
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. | |||
|
13 | # | |||
|
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. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | require 'welcome_controller' | |||
|
20 | ||||
|
21 | # Re-raise errors caught by the controller. | |||
|
22 | class WelcomeController; def rescue_action(e) raise e end; end | |||
|
23 | ||||
|
24 | class WelcomeControllerTest < Test::Unit::TestCase | |||
|
25 | fixtures :projects, :news | |||
|
26 | ||||
|
27 | def setup | |||
|
28 | @controller = WelcomeController.new | |||
|
29 | @request = ActionController::TestRequest.new | |||
|
30 | @response = ActionController::TestResponse.new | |||
|
31 | User.current = nil | |||
|
32 | end | |||
|
33 | ||||
|
34 | def test_index | |||
|
35 | get :index | |||
|
36 | assert_response :success | |||
|
37 | assert_template 'index' | |||
|
38 | assert_not_nil assigns(:news) | |||
|
39 | assert_not_nil assigns(:projects) | |||
|
40 | assert !assigns(:projects).include?(Project.find(:first, :conditions => {:is_public => false})) | |||
|
41 | end | |||
|
42 | ||||
|
43 | def test_browser_language | |||
|
44 | Setting.default_language = 'en' | |||
|
45 | @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' | |||
|
46 | get :index | |||
|
47 | assert_equal :fr, @controller.current_language | |||
|
48 | end | |||
|
49 | end |
@@ -0,0 +1,60 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
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. | |||
|
8 | # | |||
|
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. | |||
|
13 | # | |||
|
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. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | require 'pp' | |||
|
20 | class RepositoryCvsTest < Test::Unit::TestCase | |||
|
21 | fixtures :projects | |||
|
22 | ||||
|
23 | # No '..' in the repository path | |||
|
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' | |||
|
25 | REPOSITORY_PATH.gsub!(/\//, "\\") if RUBY_PLATFORM =~ /mswin/ | |||
|
26 | # CVS module | |||
|
27 | MODULE_NAME = 'test' | |||
|
28 | ||||
|
29 | def setup | |||
|
30 | @project = Project.find(1) | |||
|
31 | assert @repository = Repository::Cvs.create(:project => @project, | |||
|
32 | :root_url => REPOSITORY_PATH, | |||
|
33 | :url => MODULE_NAME) | |||
|
34 | end | |||
|
35 | ||||
|
36 | if File.directory?(REPOSITORY_PATH) | |||
|
37 | def test_fetch_changesets_from_scratch | |||
|
38 | @repository.fetch_changesets | |||
|
39 | @repository.reload | |||
|
40 | ||||
|
41 | assert_equal 5, @repository.changesets.count | |||
|
42 | assert_equal 14, @repository.changes.count | |||
|
43 | assert_equal 'Two files changed', @repository.changesets.find_by_revision(3).comments | |||
|
44 | end | |||
|
45 | ||||
|
46 | def test_fetch_changesets_incremental | |||
|
47 | @repository.fetch_changesets | |||
|
48 | # Remove changesets with revision > 2 | |||
|
49 | @repository.changesets.find(:all, :conditions => 'revision > 2').each(&:destroy) | |||
|
50 | @repository.reload | |||
|
51 | assert_equal 2, @repository.changesets.count | |||
|
52 | ||||
|
53 | @repository.fetch_changesets | |||
|
54 | assert_equal 5, @repository.changesets.count | |||
|
55 | end | |||
|
56 | else | |||
|
57 | puts "CVS test repository NOT FOUND. Skipping unit tests !!!" | |||
|
58 | def test_fake; assert true end | |||
|
59 | end | |||
|
60 | end |
@@ -1,82 +1,82 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class AdminController < ApplicationController |
|
18 | class AdminController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
20 | before_filter :require_admin |
|
20 | before_filter :require_admin | |
21 |
|
21 | |||
22 | helper :sort |
|
22 | helper :sort | |
23 | include SortHelper |
|
23 | include SortHelper | |
24 |
|
24 | |||
25 | def index |
|
25 | def index | |
26 | end |
|
26 | end | |
27 |
|
27 | |||
28 | def projects |
|
28 | def projects | |
29 | sort_init 'name', 'asc' |
|
29 | sort_init 'name', 'asc' | |
30 | sort_update |
|
30 | sort_update | |
31 |
|
31 | |||
32 | @status = params[:status] ? params[:status].to_i : 0 |
|
32 | @status = params[:status] ? params[:status].to_i : 0 | |
33 | conditions = nil |
|
33 | conditions = nil | |
34 | conditions = ["status=?", @status] unless @status == 0 |
|
34 | conditions = ["status=?", @status] unless @status == 0 | |
35 |
|
35 | |||
36 | @project_count = Project.count(:conditions => conditions) |
|
36 | @project_count = Project.count(:conditions => conditions) | |
37 | @project_pages = Paginator.new self, @project_count, |
|
37 | @project_pages = Paginator.new self, @project_count, | |
38 | 25, |
|
38 | 25, | |
39 | params['page'] |
|
39 | params['page'] | |
40 | @projects = Project.find :all, :order => sort_clause, |
|
40 | @projects = Project.find :all, :order => sort_clause, | |
41 | :conditions => conditions, |
|
41 | :conditions => conditions, | |
42 | :limit => @project_pages.items_per_page, |
|
42 | :limit => @project_pages.items_per_page, | |
43 | :offset => @project_pages.current.offset |
|
43 | :offset => @project_pages.current.offset | |
44 |
|
44 | |||
45 | render :action => "projects", :layout => false if request.xhr? |
|
45 | render :action => "projects", :layout => false if request.xhr? | |
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 | def mail_options |
|
48 | def mail_options | |
49 | @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) |
|
49 | @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) | |
50 | if request.post? |
|
50 | if request.post? | |
51 | settings = (params[:settings] || {}).dup |
|
51 | settings = (params[:settings] || {}).dup.symbolize_keys | |
52 | settings[:notified_events] ||= [] |
|
52 | settings[:notified_events] ||= [] | |
53 | settings.each { |name, value| Setting[name] = value } |
|
53 | settings.each { |name, value| Setting[name] = value } | |
54 | flash[:notice] = l(:notice_successful_update) |
|
54 | flash[:notice] = l(:notice_successful_update) | |
55 | redirect_to :controller => 'admin', :action => 'mail_options' |
|
55 | redirect_to :controller => 'admin', :action => 'mail_options' | |
56 | end |
|
56 | end | |
57 | end |
|
57 | end | |
58 |
|
58 | |||
59 | def test_email |
|
59 | def test_email | |
60 | raise_delivery_errors = ActionMailer::Base.raise_delivery_errors |
|
60 | raise_delivery_errors = ActionMailer::Base.raise_delivery_errors | |
61 | # Force ActionMailer to raise delivery errors so we can catch it |
|
61 | # Force ActionMailer to raise delivery errors so we can catch it | |
62 | ActionMailer::Base.raise_delivery_errors = true |
|
62 | ActionMailer::Base.raise_delivery_errors = true | |
63 | begin |
|
63 | begin | |
64 | @test = Mailer.deliver_test(User.current) |
|
64 | @test = Mailer.deliver_test(User.current) | |
65 | flash[:notice] = l(:notice_email_sent, User.current.mail) |
|
65 | flash[:notice] = l(:notice_email_sent, User.current.mail) | |
66 | rescue Exception => e |
|
66 | rescue Exception => e | |
67 | flash[:error] = l(:notice_email_error, e.message) |
|
67 | flash[:error] = l(:notice_email_error, e.message) | |
68 | end |
|
68 | end | |
69 | ActionMailer::Base.raise_delivery_errors = raise_delivery_errors |
|
69 | ActionMailer::Base.raise_delivery_errors = raise_delivery_errors | |
70 | redirect_to :action => 'mail_options' |
|
70 | redirect_to :action => 'mail_options' | |
71 | end |
|
71 | end | |
72 |
|
72 | |||
73 | def info |
|
73 | def info | |
74 | @db_adapter_name = ActiveRecord::Base.connection.adapter_name |
|
74 | @db_adapter_name = ActiveRecord::Base.connection.adapter_name | |
75 | @flags = { |
|
75 | @flags = { | |
76 | :default_admin_changed => User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?, |
|
76 | :default_admin_changed => User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?, | |
77 | :file_repository_writable => File.writable?(Attachment.storage_path), |
|
77 | :file_repository_writable => File.writable?(Attachment.storage_path), | |
78 | :rmagick_available => Object.const_defined?(:Magick) |
|
78 | :rmagick_available => Object.const_defined?(:Magick) | |
79 | } |
|
79 | } | |
80 | @plugins = Redmine::Plugin.registered_plugins |
|
80 | @plugins = Redmine::Plugin.registered_plugins | |
81 | end |
|
81 | end | |
82 | end |
|
82 | end |
@@ -1,13 +1,17 | |||||
1 | Creating test repositories |
|
1 | Creating test repositories | |
2 | =================== |
|
2 | =================== | |
3 |
|
3 | |||
4 | mkdir tmp/test |
|
4 | mkdir tmp/test | |
5 |
|
5 | |||
6 | Subversion |
|
6 | Subversion | |
7 | ---------- |
|
7 | ---------- | |
8 | svnadmin create tmp/test/subversion_repository |
|
8 | svnadmin create tmp/test/subversion_repository | |
9 | gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository |
|
9 | gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository | |
10 |
|
10 | |||
|
11 | CVS | |||
|
12 | --- | |||
|
13 | gunzip < test/fixtures/repositories/cvs_repository.tar.gz | tar -xv -C tmp/test | |||
|
14 | ||||
11 | Bazaar |
|
15 | Bazaar | |
12 | ------ |
|
16 | ------ | |
13 | gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test No newline at end of file |
|
17 | gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test |
@@ -1,161 +1,163 | |||||
1 | --- |
|
1 | --- | |
2 | roles_004: |
|
2 | roles_004: | |
3 | name: Non member |
|
3 | name: Non member | |
4 | id: 4 |
|
4 | id: 4 | |
5 | builtin: 1 |
|
5 | builtin: 1 | |
6 | permissions: | |
|
6 | permissions: | | |
7 | --- |
|
7 | --- | |
8 | - :add_issues |
|
8 | - :add_issues | |
9 | - :edit_issues |
|
9 | - :edit_issues | |
10 | - :manage_issue_relations |
|
10 | - :manage_issue_relations | |
11 | - :add_issue_notes |
|
11 | - :add_issue_notes | |
12 | - :change_issue_status |
|
12 | - :change_issue_status | |
13 | - :move_issues |
|
13 | - :move_issues | |
14 | - :save_queries |
|
14 | - :save_queries | |
15 | - :view_gantt |
|
15 | - :view_gantt | |
16 | - :view_calendar |
|
16 | - :view_calendar | |
17 | - :log_time |
|
17 | - :log_time | |
18 | - :view_time_entries |
|
18 | - :view_time_entries | |
19 | - :comment_news |
|
19 | - :comment_news | |
20 | - :view_documents |
|
20 | - :view_documents | |
21 | - :manage_documents |
|
21 | - :manage_documents | |
22 | - :view_wiki_pages |
|
22 | - :view_wiki_pages | |
23 | - :edit_wiki_pages |
|
23 | - :edit_wiki_pages | |
24 | - :add_messages |
|
24 | - :add_messages | |
25 | - :view_files |
|
25 | - :view_files | |
26 | - :manage_files |
|
26 | - :manage_files | |
27 | - :browse_repository |
|
27 | - :browse_repository | |
28 | - :view_changesets |
|
28 | - :view_changesets | |
29 |
|
29 | |||
30 | position: 5 |
|
30 | position: 5 | |
31 | roles_005: |
|
31 | roles_005: | |
32 | name: Anonymous |
|
32 | name: Anonymous | |
33 | id: 5 |
|
33 | id: 5 | |
34 | builtin: 2 |
|
34 | builtin: 2 | |
35 | permissions: | |
|
35 | permissions: | | |
36 | --- |
|
36 | --- | |
37 | - :view_gantt |
|
37 | - :view_gantt | |
38 | - :view_calendar |
|
38 | - :view_calendar | |
39 | - :view_time_entries |
|
39 | - :view_time_entries | |
40 | - :view_documents |
|
40 | - :view_documents | |
41 | - :view_wiki_pages |
|
41 | - :view_wiki_pages | |
42 | - :edit_wiki_pages |
|
42 | - :edit_wiki_pages | |
43 | - :view_files |
|
43 | - :view_files | |
44 | - :browse_repository |
|
44 | - :browse_repository | |
45 | - :view_changesets |
|
45 | - :view_changesets | |
46 |
|
46 | |||
47 | position: 6 |
|
47 | position: 6 | |
48 | roles_001: |
|
48 | roles_001: | |
49 | name: Manager |
|
49 | name: Manager | |
50 | id: 1 |
|
50 | id: 1 | |
51 | builtin: 0 |
|
51 | builtin: 0 | |
52 | permissions: | |
|
52 | permissions: | | |
53 | --- |
|
53 | --- | |
54 | - :edit_project |
|
54 | - :edit_project | |
55 | - :manage_members |
|
55 | - :manage_members | |
56 | - :manage_versions |
|
56 | - :manage_versions | |
57 | - :manage_categories |
|
57 | - :manage_categories | |
58 | - :add_issues |
|
58 | - :add_issues | |
59 | - :edit_issues |
|
59 | - :edit_issues | |
60 | - :manage_issue_relations |
|
60 | - :manage_issue_relations | |
61 | - :add_issue_notes |
|
61 | - :add_issue_notes | |
62 | - :change_issue_status |
|
62 | - :change_issue_status | |
63 | - :move_issues |
|
63 | - :move_issues | |
64 | - :delete_issues |
|
64 | - :delete_issues | |
65 | - :manage_public_queries |
|
65 | - :manage_public_queries | |
66 | - :save_queries |
|
66 | - :save_queries | |
67 | - :view_gantt |
|
67 | - :view_gantt | |
68 | - :view_calendar |
|
68 | - :view_calendar | |
69 | - :log_time |
|
69 | - :log_time | |
70 | - :view_time_entries |
|
70 | - :view_time_entries | |
71 | - :manage_news |
|
71 | - :manage_news | |
72 | - :comment_news |
|
72 | - :comment_news | |
73 | - :view_documents |
|
73 | - :view_documents | |
74 | - :manage_documents |
|
74 | - :manage_documents | |
75 | - :view_wiki_pages |
|
75 | - :view_wiki_pages | |
76 | - :edit_wiki_pages |
|
76 | - :edit_wiki_pages | |
77 | - :delete_wiki_pages |
|
77 | - :delete_wiki_pages | |
78 | - :add_messages |
|
78 | - :add_messages | |
|
79 | - :edit_messages | |||
|
80 | - :delete_messages | |||
79 | - :manage_boards |
|
81 | - :manage_boards | |
80 | - :view_files |
|
82 | - :view_files | |
81 | - :manage_files |
|
83 | - :manage_files | |
82 | - :browse_repository |
|
84 | - :browse_repository | |
83 | - :view_changesets |
|
85 | - :view_changesets | |
84 |
|
86 | |||
85 | position: 2 |
|
87 | position: 2 | |
86 | roles_002: |
|
88 | roles_002: | |
87 | name: Developer |
|
89 | name: Developer | |
88 | id: 2 |
|
90 | id: 2 | |
89 | builtin: 0 |
|
91 | builtin: 0 | |
90 | permissions: | |
|
92 | permissions: | | |
91 | --- |
|
93 | --- | |
92 | - :edit_project |
|
94 | - :edit_project | |
93 | - :manage_members |
|
95 | - :manage_members | |
94 | - :manage_versions |
|
96 | - :manage_versions | |
95 | - :manage_categories |
|
97 | - :manage_categories | |
96 | - :add_issues |
|
98 | - :add_issues | |
97 | - :edit_issues |
|
99 | - :edit_issues | |
98 | - :manage_issue_relations |
|
100 | - :manage_issue_relations | |
99 | - :add_issue_notes |
|
101 | - :add_issue_notes | |
100 | - :change_issue_status |
|
102 | - :change_issue_status | |
101 | - :move_issues |
|
103 | - :move_issues | |
102 | - :delete_issues |
|
104 | - :delete_issues | |
103 | - :manage_public_queries |
|
105 | - :manage_public_queries | |
104 | - :save_queries |
|
106 | - :save_queries | |
105 | - :view_gantt |
|
107 | - :view_gantt | |
106 | - :view_calendar |
|
108 | - :view_calendar | |
107 | - :log_time |
|
109 | - :log_time | |
108 | - :view_time_entries |
|
110 | - :view_time_entries | |
109 | - :manage_news |
|
111 | - :manage_news | |
110 | - :comment_news |
|
112 | - :comment_news | |
111 | - :view_documents |
|
113 | - :view_documents | |
112 | - :manage_documents |
|
114 | - :manage_documents | |
113 | - :view_wiki_pages |
|
115 | - :view_wiki_pages | |
114 | - :edit_wiki_pages |
|
116 | - :edit_wiki_pages | |
115 | - :delete_wiki_pages |
|
117 | - :delete_wiki_pages | |
116 | - :add_messages |
|
118 | - :add_messages | |
117 | - :manage_boards |
|
119 | - :manage_boards | |
118 | - :view_files |
|
120 | - :view_files | |
119 | - :manage_files |
|
121 | - :manage_files | |
120 | - :browse_repository |
|
122 | - :browse_repository | |
121 | - :view_changesets |
|
123 | - :view_changesets | |
122 |
|
124 | |||
123 | position: 3 |
|
125 | position: 3 | |
124 | roles_003: |
|
126 | roles_003: | |
125 | name: Reporter |
|
127 | name: Reporter | |
126 | id: 3 |
|
128 | id: 3 | |
127 | builtin: 0 |
|
129 | builtin: 0 | |
128 | permissions: | |
|
130 | permissions: | | |
129 | --- |
|
131 | --- | |
130 | - :edit_project |
|
132 | - :edit_project | |
131 | - :manage_members |
|
133 | - :manage_members | |
132 | - :manage_versions |
|
134 | - :manage_versions | |
133 | - :manage_categories |
|
135 | - :manage_categories | |
134 | - :add_issues |
|
136 | - :add_issues | |
135 | - :edit_issues |
|
137 | - :edit_issues | |
136 | - :manage_issue_relations |
|
138 | - :manage_issue_relations | |
137 | - :add_issue_notes |
|
139 | - :add_issue_notes | |
138 | - :change_issue_status |
|
140 | - :change_issue_status | |
139 | - :move_issues |
|
141 | - :move_issues | |
140 | - :delete_issues |
|
142 | - :delete_issues | |
141 | - :manage_public_queries |
|
143 | - :manage_public_queries | |
142 | - :save_queries |
|
144 | - :save_queries | |
143 | - :view_gantt |
|
145 | - :view_gantt | |
144 | - :view_calendar |
|
146 | - :view_calendar | |
145 | - :log_time |
|
147 | - :log_time | |
146 | - :view_time_entries |
|
148 | - :view_time_entries | |
147 | - :manage_news |
|
149 | - :manage_news | |
148 | - :comment_news |
|
150 | - :comment_news | |
149 | - :view_documents |
|
151 | - :view_documents | |
150 | - :manage_documents |
|
152 | - :manage_documents | |
151 | - :view_wiki_pages |
|
153 | - :view_wiki_pages | |
152 | - :edit_wiki_pages |
|
154 | - :edit_wiki_pages | |
153 | - :delete_wiki_pages |
|
155 | - :delete_wiki_pages | |
154 | - :add_messages |
|
156 | - :add_messages | |
155 | - :manage_boards |
|
157 | - :manage_boards | |
156 | - :view_files |
|
158 | - :view_files | |
157 | - :manage_files |
|
159 | - :manage_files | |
158 | - :browse_repository |
|
160 | - :browse_repository | |
159 | - :view_changesets |
|
161 | - :view_changesets | |
160 |
|
162 | |||
161 | position: 4 |
|
163 | position: 4 |
@@ -1,153 +1,163 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'issues_controller' |
|
19 | require 'issues_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class IssuesController; def rescue_action(e) raise e end; end |
|
22 | class IssuesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class IssuesControllerTest < Test::Unit::TestCase |
|
24 | class IssuesControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :issues, :enabled_modules, :enumerations |
|
25 | fixtures :projects, | |
|
26 | :users, | |||
|
27 | :roles, | |||
|
28 | :members, | |||
|
29 | :issues, | |||
|
30 | :issue_statuses, | |||
|
31 | :trackers, | |||
|
32 | :issue_categories, | |||
|
33 | :enabled_modules, | |||
|
34 | :enumerations, | |||
|
35 | :attachments | |||
26 |
|
36 | |||
27 | def setup |
|
37 | def setup | |
28 | @controller = IssuesController.new |
|
38 | @controller = IssuesController.new | |
29 | @request = ActionController::TestRequest.new |
|
39 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
40 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
41 | User.current = nil | |
32 | end |
|
42 | end | |
33 |
|
43 | |||
34 | def test_index |
|
44 | def test_index | |
35 | get :index |
|
45 | get :index | |
36 | assert_response :success |
|
46 | assert_response :success | |
37 | assert_template 'index.rhtml' |
|
47 | assert_template 'index.rhtml' | |
38 | assert_not_nil assigns(:issues) |
|
48 | assert_not_nil assigns(:issues) | |
39 | assert_nil assigns(:project) |
|
49 | assert_nil assigns(:project) | |
40 | end |
|
50 | end | |
41 |
|
51 | |||
42 | def test_index_with_project |
|
52 | def test_index_with_project | |
43 | get :index, :project_id => 1 |
|
53 | get :index, :project_id => 1 | |
44 | assert_response :success |
|
54 | assert_response :success | |
45 | assert_template 'index.rhtml' |
|
55 | assert_template 'index.rhtml' | |
46 | assert_not_nil assigns(:issues) |
|
56 | assert_not_nil assigns(:issues) | |
47 | end |
|
57 | end | |
48 |
|
58 | |||
49 | def test_index_with_project_and_filter |
|
59 | def test_index_with_project_and_filter | |
50 | get :index, :project_id => 1, :set_filter => 1 |
|
60 | get :index, :project_id => 1, :set_filter => 1 | |
51 | assert_response :success |
|
61 | assert_response :success | |
52 | assert_template 'index.rhtml' |
|
62 | assert_template 'index.rhtml' | |
53 | assert_not_nil assigns(:issues) |
|
63 | assert_not_nil assigns(:issues) | |
54 | end |
|
64 | end | |
55 |
|
65 | |||
56 | def test_index_csv_with_project |
|
66 | def test_index_csv_with_project | |
57 | get :index, :format => 'csv' |
|
67 | get :index, :format => 'csv' | |
58 | assert_response :success |
|
68 | assert_response :success | |
59 | assert_not_nil assigns(:issues) |
|
69 | assert_not_nil assigns(:issues) | |
60 | assert_equal 'text/csv', @response.content_type |
|
70 | assert_equal 'text/csv', @response.content_type | |
61 |
|
71 | |||
62 | get :index, :project_id => 1, :format => 'csv' |
|
72 | get :index, :project_id => 1, :format => 'csv' | |
63 | assert_response :success |
|
73 | assert_response :success | |
64 | assert_not_nil assigns(:issues) |
|
74 | assert_not_nil assigns(:issues) | |
65 | assert_equal 'text/csv', @response.content_type |
|
75 | assert_equal 'text/csv', @response.content_type | |
66 | end |
|
76 | end | |
67 |
|
77 | |||
68 | def test_index_pdf |
|
78 | def test_index_pdf | |
69 | get :index, :format => 'pdf' |
|
79 | get :index, :format => 'pdf' | |
70 | assert_response :success |
|
80 | assert_response :success | |
71 | assert_not_nil assigns(:issues) |
|
81 | assert_not_nil assigns(:issues) | |
72 | assert_equal 'application/pdf', @response.content_type |
|
82 | assert_equal 'application/pdf', @response.content_type | |
73 |
|
83 | |||
74 | get :index, :project_id => 1, :format => 'pdf' |
|
84 | get :index, :project_id => 1, :format => 'pdf' | |
75 | assert_response :success |
|
85 | assert_response :success | |
76 | assert_not_nil assigns(:issues) |
|
86 | assert_not_nil assigns(:issues) | |
77 | assert_equal 'application/pdf', @response.content_type |
|
87 | assert_equal 'application/pdf', @response.content_type | |
78 | end |
|
88 | end | |
79 |
|
89 | |||
80 | def test_changes |
|
90 | def test_changes | |
81 | get :changes, :project_id => 1 |
|
91 | get :changes, :project_id => 1 | |
82 | assert_response :success |
|
92 | assert_response :success | |
83 | assert_not_nil assigns(:changes) |
|
93 | assert_not_nil assigns(:changes) | |
84 | assert_equal 'application/atom+xml', @response.content_type |
|
94 | assert_equal 'application/atom+xml', @response.content_type | |
85 | end |
|
95 | end | |
86 |
|
96 | |||
87 | def test_show |
|
97 | def test_show | |
88 | get :show, :id => 1 |
|
98 | get :show, :id => 1 | |
89 | assert_response :success |
|
99 | assert_response :success | |
90 | assert_template 'show.rhtml' |
|
100 | assert_template 'show.rhtml' | |
91 | assert_not_nil assigns(:issue) |
|
101 | assert_not_nil assigns(:issue) | |
92 | end |
|
102 | end | |
93 |
|
103 | |||
94 | def test_get_edit |
|
104 | def test_get_edit | |
95 | @request.session[:user_id] = 2 |
|
105 | @request.session[:user_id] = 2 | |
96 | get :edit, :id => 1 |
|
106 | get :edit, :id => 1 | |
97 | assert_response :success |
|
107 | assert_response :success | |
98 | assert_template 'edit' |
|
108 | assert_template 'edit' | |
99 | assert_not_nil assigns(:issue) |
|
109 | assert_not_nil assigns(:issue) | |
100 | assert_equal Issue.find(1), assigns(:issue) |
|
110 | assert_equal Issue.find(1), assigns(:issue) | |
101 | end |
|
111 | end | |
102 |
|
112 | |||
103 | def test_post_edit |
|
113 | def test_post_edit | |
104 | @request.session[:user_id] = 2 |
|
114 | @request.session[:user_id] = 2 | |
105 | post :edit, :id => 1, :issue => {:subject => 'Modified subject'} |
|
115 | post :edit, :id => 1, :issue => {:subject => 'Modified subject'} | |
106 | assert_redirected_to 'issues/show/1' |
|
116 | assert_redirected_to 'issues/show/1' | |
107 | assert_equal 'Modified subject', Issue.find(1).subject |
|
117 | assert_equal 'Modified subject', Issue.find(1).subject | |
108 | end |
|
118 | end | |
109 |
|
119 | |||
110 | def test_post_change_status |
|
120 | def test_post_change_status | |
111 | issue = Issue.find(1) |
|
121 | issue = Issue.find(1) | |
112 | assert_equal 1, issue.status_id |
|
122 | assert_equal 1, issue.status_id | |
113 | @request.session[:user_id] = 2 |
|
123 | @request.session[:user_id] = 2 | |
114 | post :change_status, :id => 1, |
|
124 | post :change_status, :id => 1, | |
115 | :new_status_id => 2, |
|
125 | :new_status_id => 2, | |
116 | :issue => { :assigned_to_id => 3 }, |
|
126 | :issue => { :assigned_to_id => 3 }, | |
117 | :notes => 'Assigned to dlopper', |
|
127 | :notes => 'Assigned to dlopper', | |
118 | :confirm => 1 |
|
128 | :confirm => 1 | |
119 | assert_redirected_to 'issues/show/1' |
|
129 | assert_redirected_to 'issues/show/1' | |
120 | issue.reload |
|
130 | issue.reload | |
121 | assert_equal 2, issue.status_id |
|
131 | assert_equal 2, issue.status_id | |
122 | j = issue.journals.find(:first, :order => 'created_on DESC') |
|
132 | j = issue.journals.find(:first, :order => 'created_on DESC') | |
123 | assert_equal 'Assigned to dlopper', j.notes |
|
133 | assert_equal 'Assigned to dlopper', j.notes | |
124 | assert_equal 2, j.details.size |
|
134 | assert_equal 2, j.details.size | |
125 | end |
|
135 | end | |
126 |
|
136 | |||
127 | def test_context_menu |
|
137 | def test_context_menu | |
128 | @request.session[:user_id] = 2 |
|
138 | @request.session[:user_id] = 2 | |
129 | get :context_menu, :id => 1 |
|
139 | get :context_menu, :id => 1 | |
130 | assert_response :success |
|
140 | assert_response :success | |
131 | assert_template 'context_menu' |
|
141 | assert_template 'context_menu' | |
132 | end |
|
142 | end | |
133 |
|
143 | |||
134 | def test_destroy |
|
144 | def test_destroy | |
135 | @request.session[:user_id] = 2 |
|
145 | @request.session[:user_id] = 2 | |
136 | post :destroy, :id => 1 |
|
146 | post :destroy, :id => 1 | |
137 | assert_redirected_to 'projects/1/issues' |
|
147 | assert_redirected_to 'projects/1/issues' | |
138 | assert_nil Issue.find_by_id(1) |
|
148 | assert_nil Issue.find_by_id(1) | |
139 | end |
|
149 | end | |
140 |
|
150 | |||
141 | def test_destroy_attachment |
|
151 | def test_destroy_attachment | |
142 | issue = Issue.find(3) |
|
152 | issue = Issue.find(3) | |
143 | a = issue.attachments.size |
|
153 | a = issue.attachments.size | |
144 | @request.session[:user_id] = 2 |
|
154 | @request.session[:user_id] = 2 | |
145 | post :destroy_attachment, :id => 3, :attachment_id => 1 |
|
155 | post :destroy_attachment, :id => 3, :attachment_id => 1 | |
146 | assert_redirected_to 'issues/show/3' |
|
156 | assert_redirected_to 'issues/show/3' | |
147 | assert_nil Attachment.find_by_id(1) |
|
157 | assert_nil Attachment.find_by_id(1) | |
148 | issue.reload |
|
158 | issue.reload | |
149 | assert_equal((a-1), issue.attachments.size) |
|
159 | assert_equal((a-1), issue.attachments.size) | |
150 | j = issue.journals.find(:first, :order => 'created_on DESC') |
|
160 | j = issue.journals.find(:first, :order => 'created_on DESC') | |
151 | assert_equal 'attachment', j.details.first.property |
|
161 | assert_equal 'attachment', j.details.first.property | |
152 | end |
|
162 | end | |
153 | end |
|
163 | end |
@@ -1,49 +1,99 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'messages_controller' |
|
19 | require 'messages_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class MessagesController; def rescue_action(e) raise e end; end |
|
22 | class MessagesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class MessagesControllerTest < Test::Unit::TestCase |
|
24 | class MessagesControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules |
|
25 | fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = MessagesController.new |
|
28 | @controller = MessagesController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
30 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
31 | User.current = nil | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_show |
|
34 | def test_show | |
35 | get :show, :board_id => 1, :id => 1 |
|
35 | get :show, :board_id => 1, :id => 1 | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'show' |
|
37 | assert_template 'show' | |
38 | assert_not_nil assigns(:board) |
|
38 | assert_not_nil assigns(:board) | |
39 | assert_not_nil assigns(:project) |
|
39 | assert_not_nil assigns(:project) | |
40 | assert_not_nil assigns(:topic) |
|
40 | assert_not_nil assigns(:topic) | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
|
43 | def test_show_message_not_found | |||
|
44 | get :show, :board_id => 1, :id => 99999 | |||
|
45 | assert_response 404 | |||
|
46 | end | |||
|
47 | ||||
|
48 | def test_get_new | |||
|
49 | @request.session[:user_id] = 2 | |||
|
50 | get :new, :board_id => 1 | |||
|
51 | assert_response :success | |||
|
52 | assert_template 'new' | |||
|
53 | end | |||
|
54 | ||||
|
55 | def test_post_new | |||
|
56 | @request.session[:user_id] = 2 | |||
|
57 | post :new, :board_id => 1, | |||
|
58 | :message => { :subject => 'Test created message', | |||
|
59 | :content => 'Message body'} | |||
|
60 | assert_redirected_to 'messages/show' | |||
|
61 | message = Message.find_by_subject('Test created message') | |||
|
62 | assert_not_nil message | |||
|
63 | assert_equal 'Message body', message.content | |||
|
64 | assert_equal 2, message.author_id | |||
|
65 | assert_equal 1, message.board_id | |||
|
66 | end | |||
|
67 | ||||
|
68 | def test_get_edit | |||
|
69 | @request.session[:user_id] = 2 | |||
|
70 | get :edit, :board_id => 1, :id => 1 | |||
|
71 | assert_response :success | |||
|
72 | assert_template 'edit' | |||
|
73 | end | |||
|
74 | ||||
|
75 | def test_post_edit | |||
|
76 | @request.session[:user_id] = 2 | |||
|
77 | post :edit, :board_id => 1, :id => 1, | |||
|
78 | :message => { :subject => 'New subject', | |||
|
79 | :content => 'New body'} | |||
|
80 | assert_redirected_to 'messages/show' | |||
|
81 | message = Message.find(1) | |||
|
82 | assert_equal 'New subject', message.subject | |||
|
83 | assert_equal 'New body', message.content | |||
|
84 | end | |||
|
85 | ||||
43 | def test_reply |
|
86 | def test_reply | |
44 | @request.session[:user_id] = 2 |
|
87 | @request.session[:user_id] = 2 | |
45 | post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } |
|
88 | post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } | |
46 | assert_redirected_to 'messages/show' |
|
89 | assert_redirected_to 'messages/show' | |
47 | assert Message.find_by_subject('Test reply') |
|
90 | assert Message.find_by_subject('Test reply') | |
48 | end |
|
91 | end | |
|
92 | ||||
|
93 | def test_destroy_topic | |||
|
94 | @request.session[:user_id] = 2 | |||
|
95 | post :destroy, :board_id => 1, :id => 1 | |||
|
96 | assert_redirected_to 'boards/show' | |||
|
97 | assert_nil Message.find_by_id(1) | |||
|
98 | end | |||
49 | end |
|
99 | end |
@@ -1,91 +1,91 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'my_controller' |
|
19 | require 'my_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class MyController; def rescue_action(e) raise e end; end |
|
22 | class MyController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class MyControllerTest < Test::Unit::TestCase |
|
24 | class MyControllerTest < Test::Unit::TestCase | |
25 | fixtures :users |
|
25 | fixtures :users, :issues, :issue_statuses, :trackers, :enumerations | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = MyController.new |
|
28 | @controller = MyController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @request.session[:user_id] = 2 |
|
30 | @request.session[:user_id] = 2 | |
31 | @response = ActionController::TestResponse.new |
|
31 | @response = ActionController::TestResponse.new | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_index |
|
34 | def test_index | |
35 | get :index |
|
35 | get :index | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'page' |
|
37 | assert_template 'page' | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | def test_page |
|
40 | def test_page | |
41 | get :page |
|
41 | get :page | |
42 | assert_response :success |
|
42 | assert_response :success | |
43 | assert_template 'page' |
|
43 | assert_template 'page' | |
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | def test_get_account |
|
46 | def test_get_account | |
47 | get :account |
|
47 | get :account | |
48 | assert_response :success |
|
48 | assert_response :success | |
49 | assert_template 'account' |
|
49 | assert_template 'account' | |
50 | assert_equal User.find(2), assigns(:user) |
|
50 | assert_equal User.find(2), assigns(:user) | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
53 | def test_update_account |
|
53 | def test_update_account | |
54 | post :account, :user => {:firstname => "Joe", :login => "root", :admin => 1} |
|
54 | post :account, :user => {:firstname => "Joe", :login => "root", :admin => 1} | |
55 | assert_redirected_to 'my/account' |
|
55 | assert_redirected_to 'my/account' | |
56 | user = User.find(2) |
|
56 | user = User.find(2) | |
57 | assert_equal user, assigns(:user) |
|
57 | assert_equal user, assigns(:user) | |
58 | assert_equal "Joe", user.firstname |
|
58 | assert_equal "Joe", user.firstname | |
59 | assert_equal "jsmith", user.login |
|
59 | assert_equal "jsmith", user.login | |
60 | assert !user.admin? |
|
60 | assert !user.admin? | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | def test_change_password |
|
63 | def test_change_password | |
64 | get :password |
|
64 | get :password | |
65 | assert_response :success |
|
65 | assert_response :success | |
66 | assert_template 'password' |
|
66 | assert_template 'password' | |
67 |
|
67 | |||
68 | # non matching password confirmation |
|
68 | # non matching password confirmation | |
69 | post :password, :password => 'jsmith', |
|
69 | post :password, :password => 'jsmith', | |
70 | :new_password => 'hello', |
|
70 | :new_password => 'hello', | |
71 | :new_password_confirmation => 'hello2' |
|
71 | :new_password_confirmation => 'hello2' | |
72 | assert_response :success |
|
72 | assert_response :success | |
73 | assert_template 'password' |
|
73 | assert_template 'password' | |
74 | assert_tag :tag => "div", :attributes => { :class => "errorExplanation" } |
|
74 | assert_tag :tag => "div", :attributes => { :class => "errorExplanation" } | |
75 |
|
75 | |||
76 | # wrong password |
|
76 | # wrong password | |
77 | post :password, :password => 'wrongpassword', |
|
77 | post :password, :password => 'wrongpassword', | |
78 | :new_password => 'hello', |
|
78 | :new_password => 'hello', | |
79 | :new_password_confirmation => 'hello' |
|
79 | :new_password_confirmation => 'hello' | |
80 | assert_response :success |
|
80 | assert_response :success | |
81 | assert_template 'password' |
|
81 | assert_template 'password' | |
82 | assert_equal 'Wrong password', flash[:error] |
|
82 | assert_equal 'Wrong password', flash[:error] | |
83 |
|
83 | |||
84 | # good password |
|
84 | # good password | |
85 | post :password, :password => 'jsmith', |
|
85 | post :password, :password => 'jsmith', | |
86 | :new_password => 'hello', |
|
86 | :new_password => 'hello', | |
87 | :new_password_confirmation => 'hello' |
|
87 | :new_password_confirmation => 'hello' | |
88 | assert_redirected_to 'my/account' |
|
88 | assert_redirected_to 'my/account' | |
89 | assert User.try_to_login('jsmith', 'hello') |
|
89 | assert User.try_to_login('jsmith', 'hello') | |
90 | end |
|
90 | end | |
91 | end |
|
91 | end |
@@ -1,91 +1,91 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'repositories_controller' |
|
19 | require 'repositories_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class RepositoriesControllerTest < Test::Unit::TestCase |
|
24 | class RepositoriesSubversionControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers |
|
25 | fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers | |
26 |
|
26 | |||
27 | # No '..' in the repository path for svn |
|
27 | # No '..' in the repository path for svn | |
28 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' |
|
28 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' | |
29 |
|
29 | |||
30 | def setup |
|
30 | def setup | |
31 | @controller = RepositoriesController.new |
|
31 | @controller = RepositoriesController.new | |
32 | @request = ActionController::TestRequest.new |
|
32 | @request = ActionController::TestRequest.new | |
33 | @response = ActionController::TestResponse.new |
|
33 | @response = ActionController::TestResponse.new | |
34 | User.current = nil |
|
34 | User.current = nil | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | if File.directory?(REPOSITORY_PATH) |
|
37 | if File.directory?(REPOSITORY_PATH) | |
38 | def test_show |
|
38 | def test_show | |
39 | get :show, :id => 1 |
|
39 | get :show, :id => 1 | |
40 | assert_response :success |
|
40 | assert_response :success | |
41 | assert_template 'show' |
|
41 | assert_template 'show' | |
42 | assert_not_nil assigns(:entries) |
|
42 | assert_not_nil assigns(:entries) | |
43 | assert_not_nil assigns(:changesets) |
|
43 | assert_not_nil assigns(:changesets) | |
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | def test_browse_root |
|
46 | def test_browse_root | |
47 | get :browse, :id => 1 |
|
47 | get :browse, :id => 1 | |
48 | assert_response :success |
|
48 | assert_response :success | |
49 | assert_template 'browse' |
|
49 | assert_template 'browse' | |
50 | assert_not_nil assigns(:entries) |
|
50 | assert_not_nil assigns(:entries) | |
51 | entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} |
|
51 | entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} | |
52 | assert_equal 'dir', entry.kind |
|
52 | assert_equal 'dir', entry.kind | |
53 | end |
|
53 | end | |
54 |
|
54 | |||
55 | def test_browse_directory |
|
55 | def test_browse_directory | |
56 | get :browse, :id => 1, :path => ['subversion_test'] |
|
56 | get :browse, :id => 1, :path => ['subversion_test'] | |
57 | assert_response :success |
|
57 | assert_response :success | |
58 | assert_template 'browse' |
|
58 | assert_template 'browse' | |
59 | assert_not_nil assigns(:entries) |
|
59 | assert_not_nil assigns(:entries) | |
60 | entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'} |
|
60 | entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'} | |
61 | assert_equal 'file', entry.kind |
|
61 | assert_equal 'file', entry.kind | |
62 | assert_equal 'subversion_test/helloworld.c', entry.path |
|
62 | assert_equal 'subversion_test/helloworld.c', entry.path | |
63 | end |
|
63 | end | |
64 |
|
64 | |||
65 | def test_entry |
|
65 | def test_entry | |
66 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'] |
|
66 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'] | |
67 | assert_response :success |
|
67 | assert_response :success | |
68 | assert_template 'entry' |
|
68 | assert_template 'entry' | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
71 | def test_entry_download |
|
71 | def test_entry_download | |
72 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw' |
|
72 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw' | |
73 | assert_response :success |
|
73 | assert_response :success | |
74 | end |
|
74 | end | |
75 |
|
75 | |||
76 | def test_diff |
|
76 | def test_diff | |
77 | get :diff, :id => 1, :rev => 3 |
|
77 | get :diff, :id => 1, :rev => 3 | |
78 | assert_response :success |
|
78 | assert_response :success | |
79 | assert_template 'diff' |
|
79 | assert_template 'diff' | |
80 | end |
|
80 | end | |
81 |
|
81 | |||
82 | def test_annotate |
|
82 | def test_annotate | |
83 | get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c'] |
|
83 | get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c'] | |
84 | assert_response :success |
|
84 | assert_response :success | |
85 | assert_template 'annotate' |
|
85 | assert_template 'annotate' | |
86 | end |
|
86 | end | |
87 | else |
|
87 | else | |
88 | puts "Subversion test repository NOT FOUND. Skipping functional tests !!!" |
|
88 | puts "Subversion test repository NOT FOUND. Skipping functional tests !!!" | |
89 | def test_fake; assert true end |
|
89 | def test_fake; assert true end | |
90 | end |
|
90 | end | |
91 | end |
|
91 | end |
@@ -1,42 +1,73 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'versions_controller' |
|
19 | require 'versions_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class VersionsController; def rescue_action(e) raise e end; end |
|
22 | class VersionsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class VersionsControllerTest < Test::Unit::TestCase |
|
24 | class VersionsControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :versions, :users, :roles, :members, :enabled_modules |
|
25 | fixtures :projects, :versions, :users, :roles, :members, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = VersionsController.new |
|
28 | @controller = VersionsController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
30 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
31 | User.current = nil | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_show |
|
34 | def test_show | |
35 | get :show, :id => 2 |
|
35 | get :show, :id => 2 | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'show' |
|
37 | assert_template 'show' | |
38 | assert_not_nil assigns(:version) |
|
38 | assert_not_nil assigns(:version) | |
39 |
|
39 | |||
40 | assert_tag :tag => 'h2', :content => /1.0/ |
|
40 | assert_tag :tag => 'h2', :content => /1.0/ | |
41 | end |
|
41 | end | |
|
42 | ||||
|
43 | def test_get_edit | |||
|
44 | @request.session[:user_id] = 2 | |||
|
45 | get :edit, :id => 2 | |||
|
46 | assert_response :success | |||
|
47 | assert_template 'edit' | |||
|
48 | end | |||
|
49 | ||||
|
50 | def test_post_edit | |||
|
51 | @request.session[:user_id] = 2 | |||
|
52 | post :edit, :id => 2, | |||
|
53 | :version => { :name => 'New version name', | |||
|
54 | :effective_date => Date.today.strftime("%Y-%m-%d")} | |||
|
55 | assert_redirected_to 'projects/settings/1' | |||
|
56 | version = Version.find(2) | |||
|
57 | assert_equal 'New version name', version.name | |||
|
58 | assert_equal Date.today, version.effective_date | |||
|
59 | end | |||
|
60 | ||||
|
61 | def test_destroy | |||
|
62 | @request.session[:user_id] = 2 | |||
|
63 | post :destroy, :id => 2 | |||
|
64 | assert_redirected_to 'projects/settings/1' | |||
|
65 | assert_nil Version.find_by_id(2) | |||
|
66 | end | |||
|
67 | ||||
|
68 | def test_issue_status_by | |||
|
69 | xhr :get, :status_by, :id => 2 | |||
|
70 | assert_response :success | |||
|
71 | assert_template '_issue_counts' | |||
|
72 | end | |||
42 | end |
|
73 | end |
General Comments 0
You need to be logged in to leave comments.
Login now