Mercurial > hg > soundsoftware-site
comparison test/functional/issues_controller_transaction_test.rb @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | 433d4f72a19b |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 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. |
17 | 17 |
18 require File.expand_path('../../test_helper', __FILE__) | 18 require File.expand_path('../../test_helper', __FILE__) |
19 require 'issues_controller' | 19 require 'issues_controller' |
20 | 20 |
21 class IssuesControllerTransactionTest < ActionController::TestCase | 21 class IssuesControllerTransactionTest < ActionController::TestCase |
22 tests IssuesController | |
22 fixtures :projects, | 23 fixtures :projects, |
23 :users, | 24 :users, |
24 :roles, | 25 :roles, |
25 :members, | 26 :members, |
26 :member_roles, | 27 :member_roles, |
44 :queries | 45 :queries |
45 | 46 |
46 self.use_transactional_fixtures = false | 47 self.use_transactional_fixtures = false |
47 | 48 |
48 def setup | 49 def setup |
49 @controller = IssuesController.new | |
50 @request = ActionController::TestRequest.new | |
51 @response = ActionController::TestResponse.new | |
52 User.current = nil | 50 User.current = nil |
53 end | 51 end |
54 | 52 |
55 def test_update_stale_issue_should_not_update_the_issue | 53 def test_update_stale_issue_should_not_update_the_issue |
56 issue = Issue.find(2) | 54 issue = Issue.find(2) |
104 | 102 |
105 assert_response :success | 103 assert_response :success |
106 assert_template 'edit' | 104 assert_template 'edit' |
107 attachment = Attachment.first(:order => 'id DESC') | 105 attachment = Attachment.first(:order => 'id DESC') |
108 assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token} | 106 assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token} |
109 assert_tag 'span', :content => /testfile.txt/ | 107 assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'} |
110 end | 108 end |
111 | 109 |
112 def test_update_stale_issue_without_notes_should_not_show_add_notes_option | 110 def test_update_stale_issue_without_notes_should_not_show_add_notes_option |
113 issue = Issue.find(2) | 111 issue = Issue.find(2) |
114 @request.session[:user_id] = 2 | 112 @request.session[:user_id] = 2 |
252 assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id | 250 assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id |
253 end | 251 end |
254 end | 252 end |
255 | 253 |
256 def test_index_should_rescue_invalid_sql_query | 254 def test_index_should_rescue_invalid_sql_query |
257 Query.any_instance.stubs(:statement).returns("INVALID STATEMENT") | 255 IssueQuery.any_instance.stubs(:statement).returns("INVALID STATEMENT") |
258 | 256 |
259 get :index | 257 get :index |
260 assert_response 500 | 258 assert_response 500 |
261 assert_tag 'p', :content => /An error occurred/ | 259 assert_tag 'p', :content => /An error occurred/ |
262 assert_nil session[:query] | 260 assert_nil session[:query] |