@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -23,14 +23,14 class VersionsController; def rescue_action(e) raise e end; end | |||
|
23 | 23 | |
|
24 | 24 | class VersionsControllerTest < ActionController::TestCase |
|
25 | 25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules, :issue_statuses |
|
26 | ||
|
26 | ||
|
27 | 27 | def setup |
|
28 | 28 | @controller = VersionsController.new |
|
29 | 29 | @request = ActionController::TestRequest.new |
|
30 | 30 | @response = ActionController::TestResponse.new |
|
31 | 31 | User.current = nil |
|
32 | 32 | end |
|
33 | ||
|
33 | ||
|
34 | 34 | def test_index |
|
35 | 35 | get :index, :project_id => 1 |
|
36 | 36 | assert_response :success |
@@ -43,7 +43,7 class VersionsControllerTest < ActionController::TestCase | |||
|
43 | 43 | # Context menu on issues |
|
44 | 44 | assert_select "script", :text => Regexp.new(Regexp.escape("new ContextMenu('/issues/context_menu')")) |
|
45 | 45 | end |
|
46 | ||
|
46 | ||
|
47 | 47 | def test_index_with_completed_versions |
|
48 | 48 | get :index, :project_id => 1, :completed => 1 |
|
49 | 49 | assert_response :success |
@@ -71,10 +71,10 class VersionsControllerTest < ActionController::TestCase | |||
|
71 | 71 | assert_response :success |
|
72 | 72 | assert_template 'show' |
|
73 | 73 | assert_not_nil assigns(:version) |
|
74 | ||
|
74 | ||
|
75 | 75 | assert_tag :tag => 'h2', :content => /1.0/ |
|
76 | 76 | end |
|
77 | ||
|
77 | ||
|
78 | 78 | def test_create |
|
79 | 79 | @request.session[:user_id] = 2 # manager |
|
80 | 80 | assert_difference 'Version.count' do |
@@ -85,7 +85,7 class VersionsControllerTest < ActionController::TestCase | |||
|
85 | 85 | assert_not_nil version |
|
86 | 86 | assert_equal 1, version.project_id |
|
87 | 87 | end |
|
88 | ||
|
88 | ||
|
89 | 89 | def test_create_from_issue_form |
|
90 | 90 | @request.session[:user_id] = 2 # manager |
|
91 | 91 | assert_difference 'Version.count' do |
@@ -97,14 +97,14 class VersionsControllerTest < ActionController::TestCase | |||
|
97 | 97 | assert_not_nil version |
|
98 | 98 | assert_equal 1, version.project_id |
|
99 | 99 | end |
|
100 | ||
|
100 | ||
|
101 | 101 | def test_get_edit |
|
102 | 102 | @request.session[:user_id] = 2 |
|
103 | 103 | get :edit, :id => 2 |
|
104 | 104 | assert_response :success |
|
105 | 105 | assert_template 'edit' |
|
106 | 106 | end |
|
107 | ||
|
107 | ||
|
108 | 108 | def test_close_completed |
|
109 | 109 | Version.update_all("status = 'open'") |
|
110 | 110 | @request.session[:user_id] = 2 |
@@ -112,22 +112,22 class VersionsControllerTest < ActionController::TestCase | |||
|
112 | 112 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
113 | 113 | assert_not_nil Version.find_by_status('closed') |
|
114 | 114 | end |
|
115 | ||
|
115 | ||
|
116 | 116 | def test_post_update |
|
117 | 117 | @request.session[:user_id] = 2 |
|
118 |
put :update, :id => 2, |
|
|
119 |
:version => { :name => 'New version name', |
|
|
118 | put :update, :id => 2, | |
|
119 | :version => { :name => 'New version name', | |
|
120 | 120 | :effective_date => Date.today.strftime("%Y-%m-%d")} |
|
121 | 121 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
122 | 122 | version = Version.find(2) |
|
123 | 123 | assert_equal 'New version name', version.name |
|
124 | 124 | assert_equal Date.today, version.effective_date |
|
125 | 125 | end |
|
126 | ||
|
126 | ||
|
127 | 127 | def test_post_update_with_validation_failure |
|
128 | 128 | @request.session[:user_id] = 2 |
|
129 |
put :update, :id => 2, |
|
|
130 |
:version => { :name => '', |
|
|
129 | put :update, :id => 2, | |
|
130 | :version => { :name => '', | |
|
131 | 131 | :effective_date => Date.today.strftime("%Y-%m-%d")} |
|
132 | 132 | assert_response :success |
|
133 | 133 | assert_template 'edit' |
@@ -139,13 +139,13 class VersionsControllerTest < ActionController::TestCase | |||
|
139 | 139 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
140 | 140 | assert_nil Version.find_by_id(3) |
|
141 | 141 | end |
|
142 | ||
|
142 | ||
|
143 | 143 | def test_issue_status_by |
|
144 | 144 | xhr :get, :status_by, :id => 2 |
|
145 | 145 | assert_response :success |
|
146 | 146 | assert_template '_issue_counts' |
|
147 | 147 | end |
|
148 | ||
|
148 | ||
|
149 | 149 | def test_issue_status_by_status |
|
150 | 150 | xhr :get, :status_by, :id => 2, :status_by => 'status' |
|
151 | 151 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now