@@ -1,221 +1,225 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
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. |
|
17 | 17 | |
|
18 | 18 | class UsersController < ApplicationController |
|
19 | 19 | layout 'admin' |
|
20 | 20 | |
|
21 | 21 | before_filter :require_admin, :except => :show |
|
22 | before_filter :find_user, :only => [:show, :edit, :update, :edit_membership, :destroy_membership] | |
|
22 | 23 | accept_key_auth :index, :show, :create, :update |
|
23 | 24 | |
|
24 | 25 | helper :sort |
|
25 | 26 | include SortHelper |
|
26 | 27 | helper :custom_fields |
|
27 | 28 | include CustomFieldsHelper |
|
28 | 29 | |
|
29 | 30 | def index |
|
30 | 31 | sort_init 'login', 'asc' |
|
31 | 32 | sort_update %w(login firstname lastname mail admin created_on last_login_on) |
|
32 | 33 | |
|
33 | 34 | case params[:format] |
|
34 | 35 | when 'xml', 'json' |
|
35 | 36 | @offset, @limit = api_offset_and_limit |
|
36 | 37 | else |
|
37 | 38 | @limit = per_page_option |
|
38 | 39 | end |
|
39 | 40 | |
|
40 | 41 | @status = params[:status] ? params[:status].to_i : 1 |
|
41 | 42 | c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) |
|
42 | 43 | |
|
43 | 44 | unless params[:name].blank? |
|
44 | 45 | name = "%#{params[:name].strip.downcase}%" |
|
45 | 46 | c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name] |
|
46 | 47 | end |
|
47 | 48 | |
|
48 | 49 | @user_count = User.count(:conditions => c.conditions) |
|
49 | 50 | @user_pages = Paginator.new self, @user_count, @limit, params['page'] |
|
50 | 51 | @offset ||= @user_pages.current.offset |
|
51 | 52 | @users = User.find :all, |
|
52 | 53 | :order => sort_clause, |
|
53 | 54 | :conditions => c.conditions, |
|
54 | 55 | :limit => @limit, |
|
55 | 56 | :offset => @offset |
|
56 | 57 | |
|
57 | 58 | respond_to do |format| |
|
58 | 59 | format.html { render :layout => !request.xhr? } |
|
59 | 60 | format.api |
|
60 | 61 | end |
|
61 | 62 | end |
|
62 | 63 | |
|
63 | 64 | def show |
|
64 | @user = User.find(params[:id]) | |
|
65 | ||
|
66 | 65 | # show projects based on current user visibility |
|
67 | 66 | @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current)) |
|
68 | 67 | |
|
69 | 68 | events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10) |
|
70 | 69 | @events_by_day = events.group_by(&:event_date) |
|
71 | 70 | |
|
72 | 71 | unless User.current.admin? |
|
73 | 72 | if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?) |
|
74 | 73 | render_404 |
|
75 | 74 | return |
|
76 | 75 | end |
|
77 | 76 | end |
|
78 | 77 | |
|
79 | 78 | respond_to do |format| |
|
80 | 79 | format.html { render :layout => 'base' } |
|
81 | 80 | format.api |
|
82 | 81 | end |
|
83 | rescue ActiveRecord::RecordNotFound | |
|
84 | render_404 | |
|
85 | 82 | end |
|
86 | 83 | |
|
87 | 84 | def new |
|
88 | 85 | @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) |
|
89 | 86 | @auth_sources = AuthSource.find(:all) |
|
90 | 87 | end |
|
91 | 88 | |
|
92 | 89 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
|
93 | 90 | def create |
|
94 | 91 | @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) |
|
95 | 92 | @user.safe_attributes = params[:user] |
|
96 | 93 | @user.admin = params[:user][:admin] || false |
|
97 | 94 | @user.login = params[:user][:login] |
|
98 | 95 | @user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation] unless @user.auth_source_id |
|
99 | 96 | |
|
100 | 97 | # TODO: Similar to My#account |
|
101 | 98 | @user.pref.attributes = params[:pref] |
|
102 | 99 | @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') |
|
103 | 100 | |
|
104 | 101 | if @user.save |
|
105 | 102 | @user.pref.save |
|
106 | 103 | @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) |
|
107 | 104 | |
|
108 | 105 | Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information] |
|
109 | 106 | |
|
110 | 107 | respond_to do |format| |
|
111 | 108 | format.html { |
|
112 | 109 | flash[:notice] = l(:notice_successful_create) |
|
113 | 110 | redirect_to(params[:continue] ? |
|
114 | 111 | {:controller => 'users', :action => 'new'} : |
|
115 | 112 | {:controller => 'users', :action => 'edit', :id => @user} |
|
116 | 113 | ) |
|
117 | 114 | } |
|
118 | 115 | format.api { render :action => 'show', :status => :created, :location => user_url(@user) } |
|
119 | 116 | end |
|
120 | 117 | else |
|
121 | 118 | @auth_sources = AuthSource.find(:all) |
|
122 | 119 | # Clear password input |
|
123 | 120 | @user.password = @user.password_confirmation = nil |
|
124 | 121 | |
|
125 | 122 | respond_to do |format| |
|
126 | 123 | format.html { render :action => 'new' } |
|
127 | 124 | format.api { render_validation_errors(@user) } |
|
128 | 125 | end |
|
129 | 126 | end |
|
130 | 127 | end |
|
131 | 128 | |
|
132 | 129 | def edit |
|
133 | @user = User.find(params[:id]) | |
|
134 | ||
|
135 | 130 | @auth_sources = AuthSource.find(:all) |
|
136 | 131 | @membership ||= Member.new |
|
137 | 132 | end |
|
138 | 133 | |
|
139 | 134 | verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
|
140 | 135 | def update |
|
141 | @user = User.find(params[:id]) | |
|
142 | ||
|
143 | 136 | @user.admin = params[:user][:admin] if params[:user][:admin] |
|
144 | 137 | @user.login = params[:user][:login] if params[:user][:login] |
|
145 | 138 | if params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?) |
|
146 | 139 | @user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation] |
|
147 | 140 | end |
|
148 | 141 | @user.safe_attributes = params[:user] |
|
149 | 142 | # Was the account actived ? (do it before User#save clears the change) |
|
150 | 143 | was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE]) |
|
151 | 144 | # TODO: Similar to My#account |
|
152 | 145 | @user.pref.attributes = params[:pref] |
|
153 | 146 | @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') |
|
154 | 147 | |
|
155 | 148 | if @user.save |
|
156 | 149 | @user.pref.save |
|
157 | 150 | @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) |
|
158 | 151 | |
|
159 | 152 | if was_activated |
|
160 | 153 | Mailer.deliver_account_activated(@user) |
|
161 | 154 | elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil? |
|
162 | 155 | Mailer.deliver_account_information(@user, params[:user][:password]) |
|
163 | 156 | end |
|
164 | 157 | |
|
165 | 158 | respond_to do |format| |
|
166 | 159 | format.html { |
|
167 | 160 | flash[:notice] = l(:notice_successful_update) |
|
168 | 161 | redirect_to :back |
|
169 | 162 | } |
|
170 | 163 | format.api { head :ok } |
|
171 | 164 | end |
|
172 | 165 | else |
|
173 | 166 | @auth_sources = AuthSource.find(:all) |
|
174 | 167 | @membership ||= Member.new |
|
175 | 168 | # Clear password input |
|
176 | 169 | @user.password = @user.password_confirmation = nil |
|
177 | 170 | |
|
178 | 171 | respond_to do |format| |
|
179 | 172 | format.html { render :action => :edit } |
|
180 | 173 | format.api { render_validation_errors(@user) } |
|
181 | 174 | end |
|
182 | 175 | end |
|
183 | 176 | rescue ::ActionController::RedirectBackError |
|
184 | 177 | redirect_to :controller => 'users', :action => 'edit', :id => @user |
|
185 | 178 | end |
|
186 | 179 | |
|
187 | 180 | def edit_membership |
|
188 | @user = User.find(params[:id]) | |
|
189 | 181 | @membership = Member.edit_membership(params[:membership_id], params[:membership], @user) |
|
190 | 182 | @membership.save if request.post? |
|
191 | 183 | respond_to do |format| |
|
192 | 184 | if @membership.valid? |
|
193 | 185 | format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } |
|
194 | 186 | format.js { |
|
195 | 187 | render(:update) {|page| |
|
196 | 188 | page.replace_html "tab-content-memberships", :partial => 'users/memberships' |
|
197 | 189 | page.visual_effect(:highlight, "member-#{@membership.id}") |
|
198 | 190 | } |
|
199 | 191 | } |
|
200 | 192 | else |
|
201 | 193 | format.js { |
|
202 | 194 | render(:update) {|page| |
|
203 | 195 | page.alert(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', '))) |
|
204 | 196 | } |
|
205 | 197 | } |
|
206 | 198 | end |
|
207 | 199 | end |
|
208 | 200 | end |
|
209 | 201 | |
|
210 | 202 | def destroy_membership |
|
211 | @user = User.find(params[:id]) | |
|
212 | 203 | @membership = Member.find(params[:membership_id]) |
|
213 | 204 | if request.post? && @membership.deletable? |
|
214 | 205 | @membership.destroy |
|
215 | 206 | end |
|
216 | 207 | respond_to do |format| |
|
217 | 208 | format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } |
|
218 | 209 | format.js { render(:update) {|page| page.replace_html "tab-content-memberships", :partial => 'users/memberships'} } |
|
219 | 210 | end |
|
220 | 211 | end |
|
212 | ||
|
213 | private | |
|
214 | ||
|
215 | def find_user | |
|
216 | if params[:id] == 'current' | |
|
217 | require_login || return | |
|
218 | @user = User.current | |
|
219 | else | |
|
220 | @user = User.find(params[:id]) | |
|
221 | end | |
|
222 | rescue ActiveRecord::RecordNotFound | |
|
223 | render_404 | |
|
224 | end | |
|
221 | 225 | end |
@@ -1,265 +1,279 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
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. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | require 'users_controller' |
|
20 | 20 | |
|
21 | 21 | # Re-raise errors caught by the controller. |
|
22 | 22 | class UsersController; def rescue_action(e) raise e end; end |
|
23 | 23 | |
|
24 | 24 | class UsersControllerTest < ActionController::TestCase |
|
25 | 25 | include Redmine::I18n |
|
26 | 26 | |
|
27 | 27 | fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources, :custom_fields, :custom_values |
|
28 | 28 | |
|
29 | 29 | def setup |
|
30 | 30 | @controller = UsersController.new |
|
31 | 31 | @request = ActionController::TestRequest.new |
|
32 | 32 | @response = ActionController::TestResponse.new |
|
33 | 33 | User.current = nil |
|
34 | 34 | @request.session[:user_id] = 1 # admin |
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | def test_index |
|
38 | 38 | get :index |
|
39 | 39 | assert_response :success |
|
40 | 40 | assert_template 'index' |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def test_index |
|
44 | 44 | get :index |
|
45 | 45 | assert_response :success |
|
46 | 46 | assert_template 'index' |
|
47 | 47 | assert_not_nil assigns(:users) |
|
48 | 48 | # active users only |
|
49 | 49 | assert_nil assigns(:users).detect {|u| !u.active?} |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | def test_index_with_name_filter |
|
53 | 53 | get :index, :name => 'john' |
|
54 | 54 | assert_response :success |
|
55 | 55 | assert_template 'index' |
|
56 | 56 | users = assigns(:users) |
|
57 | 57 | assert_not_nil users |
|
58 | 58 | assert_equal 1, users.size |
|
59 | 59 | assert_equal 'John', users.first.firstname |
|
60 | 60 | end |
|
61 | 61 | |
|
62 | 62 | def test_show |
|
63 | 63 | @request.session[:user_id] = nil |
|
64 | 64 | get :show, :id => 2 |
|
65 | 65 | assert_response :success |
|
66 | 66 | assert_template 'show' |
|
67 | 67 | assert_not_nil assigns(:user) |
|
68 | 68 | |
|
69 | 69 | assert_tag 'li', :content => /Phone number/ |
|
70 | 70 | end |
|
71 | 71 | |
|
72 | 72 | def test_show_should_not_display_hidden_custom_fields |
|
73 | 73 | @request.session[:user_id] = nil |
|
74 | 74 | UserCustomField.find_by_name('Phone number').update_attribute :visible, false |
|
75 | 75 | get :show, :id => 2 |
|
76 | 76 | assert_response :success |
|
77 | 77 | assert_template 'show' |
|
78 | 78 | assert_not_nil assigns(:user) |
|
79 | 79 | |
|
80 | 80 | assert_no_tag 'li', :content => /Phone number/ |
|
81 | 81 | end |
|
82 | 82 | |
|
83 | 83 | def test_show_should_not_fail_when_custom_values_are_nil |
|
84 | 84 | user = User.find(2) |
|
85 | 85 | |
|
86 | 86 | # Create a custom field to illustrate the issue |
|
87 | 87 | custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text') |
|
88 | 88 | custom_value = user.custom_values.build(:custom_field => custom_field).save! |
|
89 | 89 | |
|
90 | 90 | get :show, :id => 2 |
|
91 | 91 | assert_response :success |
|
92 | 92 | end |
|
93 | 93 | |
|
94 | 94 | def test_show_inactive |
|
95 | 95 | @request.session[:user_id] = nil |
|
96 | 96 | get :show, :id => 5 |
|
97 | 97 | assert_response 404 |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | 100 | def test_show_should_not_reveal_users_with_no_visible_activity_or_project |
|
101 | 101 | @request.session[:user_id] = nil |
|
102 | 102 | get :show, :id => 9 |
|
103 | 103 | assert_response 404 |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | def test_show_inactive_by_admin |
|
107 | 107 | @request.session[:user_id] = 1 |
|
108 | 108 | get :show, :id => 5 |
|
109 | 109 | assert_response 200 |
|
110 | 110 | assert_not_nil assigns(:user) |
|
111 | 111 | end |
|
112 | 112 | |
|
113 | 113 | def test_show_displays_memberships_based_on_project_visibility |
|
114 | 114 | @request.session[:user_id] = 1 |
|
115 | 115 | get :show, :id => 2 |
|
116 | 116 | assert_response :success |
|
117 | 117 | memberships = assigns(:memberships) |
|
118 | 118 | assert_not_nil memberships |
|
119 | 119 | project_ids = memberships.map(&:project_id) |
|
120 | 120 | assert project_ids.include?(2) #private project admin can see |
|
121 | 121 | end |
|
122 | 122 | |
|
123 | def test_show_current_should_require_authentication | |
|
124 | @request.session[:user_id] = nil | |
|
125 | get :show, :id => 'current' | |
|
126 | assert_response 302 | |
|
127 | end | |
|
128 | ||
|
129 | def test_show_current | |
|
130 | @request.session[:user_id] = 2 | |
|
131 | get :show, :id => 'current' | |
|
132 | assert_response :success | |
|
133 | assert_template 'show' | |
|
134 | assert_equal User.find(2), assigns(:user) | |
|
135 | end | |
|
136 | ||
|
123 | 137 | def test_new |
|
124 | 138 | get :new |
|
125 | 139 | |
|
126 | 140 | assert_response :success |
|
127 | 141 | assert_template :new |
|
128 | 142 | assert assigns(:user) |
|
129 | 143 | end |
|
130 | 144 | |
|
131 | 145 | def test_create |
|
132 | 146 | Setting.bcc_recipients = '1' |
|
133 | 147 | |
|
134 | 148 | assert_difference 'User.count' do |
|
135 | 149 | assert_difference 'ActionMailer::Base.deliveries.size' do |
|
136 | 150 | post :create, |
|
137 | 151 | :user => { |
|
138 | 152 | :firstname => 'John', |
|
139 | 153 | :lastname => 'Doe', |
|
140 | 154 | :login => 'jdoe', |
|
141 | 155 | :password => 'secret', |
|
142 | 156 | :password_confirmation => 'secret', |
|
143 | 157 | :mail => 'jdoe@gmail.com', |
|
144 | 158 | :mail_notification => 'none' |
|
145 | 159 | }, |
|
146 | 160 | :send_information => '1' |
|
147 | 161 | end |
|
148 | 162 | end |
|
149 | 163 | |
|
150 | 164 | user = User.first(:order => 'id DESC') |
|
151 | 165 | assert_redirected_to :controller => 'users', :action => 'edit', :id => user.id |
|
152 | 166 | |
|
153 | 167 | assert_equal 'John', user.firstname |
|
154 | 168 | assert_equal 'Doe', user.lastname |
|
155 | 169 | assert_equal 'jdoe', user.login |
|
156 | 170 | assert_equal 'jdoe@gmail.com', user.mail |
|
157 | 171 | assert_equal 'none', user.mail_notification |
|
158 | 172 | assert user.check_password?('secret') |
|
159 | 173 | |
|
160 | 174 | mail = ActionMailer::Base.deliveries.last |
|
161 | 175 | assert_not_nil mail |
|
162 | 176 | assert_equal [user.mail], mail.bcc |
|
163 | 177 | assert mail.body.include?('secret') |
|
164 | 178 | end |
|
165 | 179 | |
|
166 | 180 | def test_create_with_failure |
|
167 | 181 | assert_no_difference 'User.count' do |
|
168 | 182 | post :create, :user => {} |
|
169 | 183 | end |
|
170 | 184 | |
|
171 | 185 | assert_response :success |
|
172 | 186 | assert_template 'new' |
|
173 | 187 | end |
|
174 | 188 | |
|
175 | 189 | def test_edit |
|
176 | 190 | get :edit, :id => 2 |
|
177 | 191 | |
|
178 | 192 | assert_response :success |
|
179 | 193 | assert_template 'edit' |
|
180 | 194 | assert_equal User.find(2), assigns(:user) |
|
181 | 195 | end |
|
182 | 196 | |
|
183 | 197 | def test_update |
|
184 | 198 | ActionMailer::Base.deliveries.clear |
|
185 | 199 | put :update, :id => 2, :user => {:firstname => 'Changed', :mail_notification => 'only_assigned'}, :pref => {:hide_mail => '1', :comments_sorting => 'desc'} |
|
186 | 200 | |
|
187 | 201 | user = User.find(2) |
|
188 | 202 | assert_equal 'Changed', user.firstname |
|
189 | 203 | assert_equal 'only_assigned', user.mail_notification |
|
190 | 204 | assert_equal true, user.pref[:hide_mail] |
|
191 | 205 | assert_equal 'desc', user.pref[:comments_sorting] |
|
192 | 206 | assert ActionMailer::Base.deliveries.empty? |
|
193 | 207 | end |
|
194 | 208 | |
|
195 | 209 | def test_update_with_failure |
|
196 | 210 | assert_no_difference 'User.count' do |
|
197 | 211 | put :update, :id => 2, :user => {:firstname => ''} |
|
198 | 212 | end |
|
199 | 213 | |
|
200 | 214 | assert_response :success |
|
201 | 215 | assert_template 'edit' |
|
202 | 216 | end |
|
203 | 217 | |
|
204 | 218 | def test_update_with_group_ids_should_assign_groups |
|
205 | 219 | put :update, :id => 2, :user => {:group_ids => ['10']} |
|
206 | 220 | |
|
207 | 221 | user = User.find(2) |
|
208 | 222 | assert_equal [10], user.group_ids |
|
209 | 223 | end |
|
210 | 224 | |
|
211 | 225 | def test_update_with_activation_should_send_a_notification |
|
212 | 226 | u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr') |
|
213 | 227 | u.login = 'foo' |
|
214 | 228 | u.status = User::STATUS_REGISTERED |
|
215 | 229 | u.save! |
|
216 | 230 | ActionMailer::Base.deliveries.clear |
|
217 | 231 | Setting.bcc_recipients = '1' |
|
218 | 232 | |
|
219 | 233 | put :update, :id => u.id, :user => {:status => User::STATUS_ACTIVE} |
|
220 | 234 | assert u.reload.active? |
|
221 | 235 | mail = ActionMailer::Base.deliveries.last |
|
222 | 236 | assert_not_nil mail |
|
223 | 237 | assert_equal ['foo.bar@somenet.foo'], mail.bcc |
|
224 | 238 | assert mail.body.include?(ll('fr', :notice_account_activated)) |
|
225 | 239 | end |
|
226 | 240 | |
|
227 | 241 | def test_update_with_password_change_should_send_a_notification |
|
228 | 242 | ActionMailer::Base.deliveries.clear |
|
229 | 243 | Setting.bcc_recipients = '1' |
|
230 | 244 | |
|
231 | 245 | put :update, :id => 2, :user => {:password => 'newpass', :password_confirmation => 'newpass'}, :send_information => '1' |
|
232 | 246 | u = User.find(2) |
|
233 | 247 | assert u.check_password?('newpass') |
|
234 | 248 | |
|
235 | 249 | mail = ActionMailer::Base.deliveries.last |
|
236 | 250 | assert_not_nil mail |
|
237 | 251 | assert_equal [u.mail], mail.bcc |
|
238 | 252 | assert mail.body.include?('newpass') |
|
239 | 253 | end |
|
240 | 254 | |
|
241 | 255 | test "put :update with a password change to an AuthSource user switching to Internal authentication" do |
|
242 | 256 | # Configure as auth source |
|
243 | 257 | u = User.find(2) |
|
244 | 258 | u.auth_source = AuthSource.find(1) |
|
245 | 259 | u.save! |
|
246 | 260 | |
|
247 | 261 | put :update, :id => u.id, :user => {:auth_source_id => '', :password => 'newpass'}, :password_confirmation => 'newpass' |
|
248 | 262 | |
|
249 | 263 | assert_equal nil, u.reload.auth_source |
|
250 | 264 | assert u.check_password?('newpass') |
|
251 | 265 | end |
|
252 | 266 | |
|
253 | 267 | def test_edit_membership |
|
254 | 268 | post :edit_membership, :id => 2, :membership_id => 1, |
|
255 | 269 | :membership => { :role_ids => [2]} |
|
256 | 270 | assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships' |
|
257 | 271 | assert_equal [2], Member.find(1).role_ids |
|
258 | 272 | end |
|
259 | 273 | |
|
260 | 274 | def test_destroy_membership |
|
261 | 275 | post :destroy_membership, :id => 2, :membership_id => 1 |
|
262 | 276 | assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships' |
|
263 | 277 | assert_nil Member.find_by_id(1) |
|
264 | 278 | end |
|
265 | 279 | end |
@@ -1,258 +1,275 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
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. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../../test_helper', __FILE__) |
|
19 | 19 | require 'pp' |
|
20 | 20 | class ApiTest::UsersTest < ActionController::IntegrationTest |
|
21 | 21 | fixtures :users |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | context "GET /users" do |
|
28 | 28 | should_allow_api_authentication(:get, "/users.xml") |
|
29 | 29 | should_allow_api_authentication(:get, "/users.json") |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | context "GET /users/2" do |
|
33 | 33 | context ".xml" do |
|
34 | 34 | should "return requested user" do |
|
35 | 35 | get '/users/2.xml' |
|
36 | 36 | |
|
37 | 37 | assert_tag :tag => 'user', |
|
38 | 38 | :child => {:tag => 'id', :content => '2'} |
|
39 | 39 | end |
|
40 | 40 | end |
|
41 | 41 | |
|
42 | 42 | context ".json" do |
|
43 | 43 | should "return requested user" do |
|
44 | 44 | get '/users/2.json' |
|
45 | 45 | |
|
46 | 46 | json = ActiveSupport::JSON.decode(response.body) |
|
47 | 47 | assert_kind_of Hash, json |
|
48 | 48 | assert_kind_of Hash, json['user'] |
|
49 | 49 | assert_equal 2, json['user']['id'] |
|
50 | 50 | end |
|
51 | 51 | end |
|
52 | 52 | end |
|
53 | ||
|
54 | context "GET /users/current" do | |
|
55 | context ".xml" do | |
|
56 | should "require authentication" do | |
|
57 | get '/users/current.xml' | |
|
58 | ||
|
59 | assert_response 401 | |
|
60 | end | |
|
61 | ||
|
62 | should "return current user" do | |
|
63 | get '/users/current.xml', {}, :authorization => credentials('jsmith') | |
|
64 | ||
|
65 | assert_tag :tag => 'user', | |
|
66 | :child => {:tag => 'id', :content => '2'} | |
|
67 | end | |
|
68 | end | |
|
69 | end | |
|
53 | 70 | |
|
54 | 71 | context "POST /users" do |
|
55 | 72 | context "with valid parameters" do |
|
56 | 73 | setup do |
|
57 | 74 | @parameters = {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret', :mail_notification => 'only_assigned'}} |
|
58 | 75 | end |
|
59 | 76 | |
|
60 | 77 | context ".xml" do |
|
61 | 78 | should_allow_api_authentication(:post, |
|
62 | 79 | '/users.xml', |
|
63 | 80 | {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret'}}, |
|
64 | 81 | {:success_code => :created}) |
|
65 | 82 | |
|
66 | 83 | should "create a user with the attributes" do |
|
67 | 84 | assert_difference('User.count') do |
|
68 | 85 | post '/users.xml', @parameters, :authorization => credentials('admin') |
|
69 | 86 | end |
|
70 | 87 | |
|
71 | 88 | user = User.first(:order => 'id DESC') |
|
72 | 89 | assert_equal 'foo', user.login |
|
73 | 90 | assert_equal 'Firstname', user.firstname |
|
74 | 91 | assert_equal 'Lastname', user.lastname |
|
75 | 92 | assert_equal 'foo@example.net', user.mail |
|
76 | 93 | assert_equal 'only_assigned', user.mail_notification |
|
77 | 94 | assert !user.admin? |
|
78 | 95 | assert user.check_password?('secret') |
|
79 | 96 | |
|
80 | 97 | assert_response :created |
|
81 | 98 | assert_equal 'application/xml', @response.content_type |
|
82 | 99 | assert_tag 'user', :child => {:tag => 'id', :content => user.id.to_s} |
|
83 | 100 | end |
|
84 | 101 | end |
|
85 | 102 | |
|
86 | 103 | context ".json" do |
|
87 | 104 | should_allow_api_authentication(:post, |
|
88 | 105 | '/users.json', |
|
89 | 106 | {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net'}}, |
|
90 | 107 | {:success_code => :created}) |
|
91 | 108 | |
|
92 | 109 | should "create a user with the attributes" do |
|
93 | 110 | assert_difference('User.count') do |
|
94 | 111 | post '/users.json', @parameters, :authorization => credentials('admin') |
|
95 | 112 | end |
|
96 | 113 | |
|
97 | 114 | user = User.first(:order => 'id DESC') |
|
98 | 115 | assert_equal 'foo', user.login |
|
99 | 116 | assert_equal 'Firstname', user.firstname |
|
100 | 117 | assert_equal 'Lastname', user.lastname |
|
101 | 118 | assert_equal 'foo@example.net', user.mail |
|
102 | 119 | assert !user.admin? |
|
103 | 120 | |
|
104 | 121 | assert_response :created |
|
105 | 122 | assert_equal 'application/json', @response.content_type |
|
106 | 123 | json = ActiveSupport::JSON.decode(response.body) |
|
107 | 124 | assert_kind_of Hash, json |
|
108 | 125 | assert_kind_of Hash, json['user'] |
|
109 | 126 | assert_equal user.id, json['user']['id'] |
|
110 | 127 | end |
|
111 | 128 | end |
|
112 | 129 | end |
|
113 | 130 | |
|
114 | 131 | context "with invalid parameters" do |
|
115 | 132 | setup do |
|
116 | 133 | @parameters = {:user => {:login => 'foo', :lastname => 'Lastname', :mail => 'foo'}} |
|
117 | 134 | end |
|
118 | 135 | |
|
119 | 136 | context ".xml" do |
|
120 | 137 | should "return errors" do |
|
121 | 138 | assert_no_difference('User.count') do |
|
122 | 139 | post '/users.xml', @parameters, :authorization => credentials('admin') |
|
123 | 140 | end |
|
124 | 141 | |
|
125 | 142 | assert_response :unprocessable_entity |
|
126 | 143 | assert_equal 'application/xml', @response.content_type |
|
127 | 144 | assert_tag 'errors', :child => {:tag => 'error', :content => "Firstname can't be blank"} |
|
128 | 145 | end |
|
129 | 146 | end |
|
130 | 147 | |
|
131 | 148 | context ".json" do |
|
132 | 149 | should "return errors" do |
|
133 | 150 | assert_no_difference('User.count') do |
|
134 | 151 | post '/users.json', @parameters, :authorization => credentials('admin') |
|
135 | 152 | end |
|
136 | 153 | |
|
137 | 154 | assert_response :unprocessable_entity |
|
138 | 155 | assert_equal 'application/json', @response.content_type |
|
139 | 156 | json = ActiveSupport::JSON.decode(response.body) |
|
140 | 157 | assert_kind_of Hash, json |
|
141 | 158 | assert json.has_key?('errors') |
|
142 | 159 | assert_kind_of Array, json['errors'] |
|
143 | 160 | end |
|
144 | 161 | end |
|
145 | 162 | end |
|
146 | 163 | end |
|
147 | 164 | |
|
148 | 165 | context "PUT /users/2" do |
|
149 | 166 | context "with valid parameters" do |
|
150 | 167 | setup do |
|
151 | 168 | @parameters = {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}} |
|
152 | 169 | end |
|
153 | 170 | |
|
154 | 171 | context ".xml" do |
|
155 | 172 | should_allow_api_authentication(:put, |
|
156 | 173 | '/users/2.xml', |
|
157 | 174 | {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, |
|
158 | 175 | {:success_code => :ok}) |
|
159 | 176 | |
|
160 | 177 | should "update user with the attributes" do |
|
161 | 178 | assert_no_difference('User.count') do |
|
162 | 179 | put '/users/2.xml', @parameters, :authorization => credentials('admin') |
|
163 | 180 | end |
|
164 | 181 | |
|
165 | 182 | user = User.find(2) |
|
166 | 183 | assert_equal 'jsmith', user.login |
|
167 | 184 | assert_equal 'John', user.firstname |
|
168 | 185 | assert_equal 'Renamed', user.lastname |
|
169 | 186 | assert_equal 'jsmith@somenet.foo', user.mail |
|
170 | 187 | assert !user.admin? |
|
171 | 188 | |
|
172 | 189 | assert_response :ok |
|
173 | 190 | end |
|
174 | 191 | end |
|
175 | 192 | |
|
176 | 193 | context ".json" do |
|
177 | 194 | should_allow_api_authentication(:put, |
|
178 | 195 | '/users/2.json', |
|
179 | 196 | {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, |
|
180 | 197 | {:success_code => :ok}) |
|
181 | 198 | |
|
182 | 199 | should "update user with the attributes" do |
|
183 | 200 | assert_no_difference('User.count') do |
|
184 | 201 | put '/users/2.json', @parameters, :authorization => credentials('admin') |
|
185 | 202 | end |
|
186 | 203 | |
|
187 | 204 | user = User.find(2) |
|
188 | 205 | assert_equal 'jsmith', user.login |
|
189 | 206 | assert_equal 'John', user.firstname |
|
190 | 207 | assert_equal 'Renamed', user.lastname |
|
191 | 208 | assert_equal 'jsmith@somenet.foo', user.mail |
|
192 | 209 | assert !user.admin? |
|
193 | 210 | |
|
194 | 211 | assert_response :ok |
|
195 | 212 | end |
|
196 | 213 | end |
|
197 | 214 | end |
|
198 | 215 | |
|
199 | 216 | context "with invalid parameters" do |
|
200 | 217 | setup do |
|
201 | 218 | @parameters = {:user => {:login => 'jsmith', :firstname => '', :lastname => 'Lastname', :mail => 'foo'}} |
|
202 | 219 | end |
|
203 | 220 | |
|
204 | 221 | context ".xml" do |
|
205 | 222 | should "return errors" do |
|
206 | 223 | assert_no_difference('User.count') do |
|
207 | 224 | put '/users/2.xml', @parameters, :authorization => credentials('admin') |
|
208 | 225 | end |
|
209 | 226 | |
|
210 | 227 | assert_response :unprocessable_entity |
|
211 | 228 | assert_equal 'application/xml', @response.content_type |
|
212 | 229 | assert_tag 'errors', :child => {:tag => 'error', :content => "Firstname can't be blank"} |
|
213 | 230 | end |
|
214 | 231 | end |
|
215 | 232 | |
|
216 | 233 | context ".json" do |
|
217 | 234 | should "return errors" do |
|
218 | 235 | assert_no_difference('User.count') do |
|
219 | 236 | put '/users/2.json', @parameters, :authorization => credentials('admin') |
|
220 | 237 | end |
|
221 | 238 | |
|
222 | 239 | assert_response :unprocessable_entity |
|
223 | 240 | assert_equal 'application/json', @response.content_type |
|
224 | 241 | json = ActiveSupport::JSON.decode(response.body) |
|
225 | 242 | assert_kind_of Hash, json |
|
226 | 243 | assert json.has_key?('errors') |
|
227 | 244 | assert_kind_of Array, json['errors'] |
|
228 | 245 | end |
|
229 | 246 | end |
|
230 | 247 | end |
|
231 | 248 | |
|
232 | 249 | context "DELETE /users/2" do |
|
233 | 250 | context ".xml" do |
|
234 | 251 | should "not be allowed" do |
|
235 | 252 | assert_no_difference('User.count') do |
|
236 | 253 | delete '/users/2.xml' |
|
237 | 254 | end |
|
238 | 255 | |
|
239 | 256 | assert_response :method_not_allowed |
|
240 | 257 | end |
|
241 | 258 | end |
|
242 | 259 | |
|
243 | 260 | context ".json" do |
|
244 | 261 | should "not be allowed" do |
|
245 | 262 | assert_no_difference('User.count') do |
|
246 | 263 | delete '/users/2.json' |
|
247 | 264 | end |
|
248 | 265 | |
|
249 | 266 | assert_response :method_not_allowed |
|
250 | 267 | end |
|
251 | 268 | end |
|
252 | 269 | end |
|
253 | 270 | end |
|
254 | 271 | |
|
255 | 272 | def credentials(user, password=nil) |
|
256 | 273 | ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) |
|
257 | 274 | end |
|
258 | 275 | end |
@@ -1,347 +1,348 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
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. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class RoutingTest < ActionController::IntegrationTest |
|
21 | 21 | context "activities" do |
|
22 | 22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
23 | 23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | context "attachments" do |
|
27 | 27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
28 | 28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
29 | 29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
30 | 30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
31 | 31 | end |
|
32 | 32 | |
|
33 | 33 | context "boards" do |
|
34 | 34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
35 | 35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
36 | 36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
37 | 37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
38 | 38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
39 | 39 | |
|
40 | 40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
41 | 41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
42 | 42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
43 | 43 | |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | context "documents" do |
|
47 | 47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
48 | 48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
49 | 49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
50 | 50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
51 | 51 | |
|
52 | 52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
53 | 53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' |
|
54 | 54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | 57 | context "issues" do |
|
58 | 58 | # REST actions |
|
59 | 59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
60 | 60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
61 | 61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
62 | 62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
63 | 63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
64 | 64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
65 | 65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
66 | 66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
67 | 67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
68 | 68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
69 | 69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
70 | 70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
71 | 71 | |
|
72 | 72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
73 | 73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
74 | 74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
75 | 75 | |
|
76 | 76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
77 | 77 | # TODO: Should use PUT |
|
78 | 78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
79 | 79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
80 | 80 | |
|
81 | 81 | # TODO: Should use DELETE |
|
82 | 82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
83 | 83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
84 | 84 | |
|
85 | 85 | # Extra actions |
|
86 | 86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
87 | 87 | |
|
88 | 88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
89 | 89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
90 | 90 | |
|
91 | 91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
92 | 92 | |
|
93 | 93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
94 | 94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' |
|
95 | 95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
96 | 96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' |
|
97 | 97 | |
|
98 | 98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
99 | 99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' |
|
100 | 100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
101 | 101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' |
|
102 | 102 | |
|
103 | 103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
104 | 104 | |
|
105 | 105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
106 | 106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
107 | 107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
108 | 108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
109 | 109 | |
|
110 | 110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
111 | 111 | |
|
112 | 112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
113 | 113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
114 | 114 | end |
|
115 | 115 | |
|
116 | 116 | context "issue categories" do |
|
117 | 117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
118 | 118 | |
|
119 | 119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | 122 | context "issue relations" do |
|
123 | 123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' |
|
124 | 124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | 127 | context "issue reports" do |
|
128 | 128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
129 | 129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
130 | 130 | end |
|
131 | 131 | |
|
132 | 132 | context "members" do |
|
133 | 133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
134 | 134 | end |
|
135 | 135 | |
|
136 | 136 | context "messages" do |
|
137 | 137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
138 | 138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
139 | 139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
140 | 140 | |
|
141 | 141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
142 | 142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
143 | 143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
144 | 144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
145 | 145 | end |
|
146 | 146 | |
|
147 | 147 | context "news" do |
|
148 | 148 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
149 | 149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
150 | 150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
151 | 151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
152 | 152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
153 | 153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
154 | 154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
155 | 155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
156 | 156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
157 | 157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
158 | 158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
159 | 159 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
160 | 160 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' |
|
161 | 161 | |
|
162 | 162 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' |
|
163 | 163 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' |
|
164 | 164 | |
|
165 | 165 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' |
|
166 | 166 | |
|
167 | 167 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' |
|
168 | 168 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' |
|
169 | 169 | end |
|
170 | 170 | |
|
171 | 171 | context "projects" do |
|
172 | 172 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
173 | 173 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
174 | 174 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
175 | 175 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
176 | 176 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
177 | 177 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
178 | 178 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
179 | 179 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
180 | 180 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' |
|
181 | 181 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' |
|
182 | 182 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
183 | 183 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
184 | 184 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
185 | 185 | |
|
186 | 186 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
187 | 187 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
188 | 188 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' |
|
189 | 189 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
190 | 190 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
191 | 191 | |
|
192 | 192 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' |
|
193 | 193 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
194 | 194 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
195 | 195 | |
|
196 | 196 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
197 | 197 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
198 | 198 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' |
|
199 | 199 | end |
|
200 | 200 | |
|
201 | 201 | context "repositories" do |
|
202 | 202 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
203 | 203 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
204 | 204 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
205 | 205 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
206 | 206 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
207 | 207 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
208 | 208 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
209 | 209 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
210 | 210 | should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
211 | 211 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
212 | 212 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
213 | 213 | should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
214 | 214 | should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' |
|
215 | 215 | should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' |
|
216 | 216 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
217 | 217 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
218 | 218 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
219 | 219 | |
|
220 | 220 | |
|
221 | 221 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
222 | 222 | end |
|
223 | 223 | |
|
224 | 224 | context "timelogs (global)" do |
|
225 | 225 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' |
|
226 | 226 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' |
|
227 | 227 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' |
|
228 | 228 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' |
|
229 | 229 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
230 | 230 | |
|
231 | 231 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' |
|
232 | 232 | |
|
233 | 233 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' |
|
234 | 234 | |
|
235 | 235 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
236 | 236 | end |
|
237 | 237 | |
|
238 | 238 | context "timelogs (scoped under project)" do |
|
239 | 239 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' |
|
240 | 240 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' |
|
241 | 241 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' |
|
242 | 242 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' |
|
243 | 243 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' |
|
244 | 244 | |
|
245 | 245 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' |
|
246 | 246 | |
|
247 | 247 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' |
|
248 | 248 | |
|
249 | 249 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' |
|
250 | 250 | end |
|
251 | 251 | |
|
252 | 252 | context "timelogs (scoped under issues)" do |
|
253 | 253 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' |
|
254 | 254 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' |
|
255 | 255 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' |
|
256 | 256 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' |
|
257 | 257 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' |
|
258 | 258 | |
|
259 | 259 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' |
|
260 | 260 | |
|
261 | 261 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' |
|
262 | 262 | |
|
263 | 263 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' |
|
264 | 264 | end |
|
265 | 265 | |
|
266 | 266 | context "timelogs (scoped under project and issues)" do |
|
267 | 267 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' |
|
268 | 268 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' |
|
269 | 269 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' |
|
270 | 270 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' |
|
271 | 271 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
272 | 272 | |
|
273 | 273 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' |
|
274 | 274 | |
|
275 | 275 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
276 | 276 | |
|
277 | 277 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' |
|
278 | 278 | end |
|
279 | 279 | |
|
280 | 280 | context "time_entry_reports" do |
|
281 | 281 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' |
|
282 | 282 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' |
|
283 | 283 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
284 | 284 | end |
|
285 | 285 | |
|
286 | 286 | context "users" do |
|
287 | 287 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
288 | 288 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
289 | should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current' | |
|
289 | 290 | should_route :get, "/users/new", :controller => 'users', :action => 'new' |
|
290 | 291 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
291 | 292 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
292 | 293 | |
|
293 | 294 | should_route :post, "/users", :controller => 'users', :action => 'create' |
|
294 | 295 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
295 | 296 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
296 | 297 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
297 | 298 | |
|
298 | 299 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' |
|
299 | 300 | end |
|
300 | 301 | |
|
301 | 302 | # TODO: should they all be scoped under /projects/:project_id ? |
|
302 | 303 | context "versions" do |
|
303 | 304 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
304 | 305 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' |
|
305 | 306 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' |
|
306 | 307 | |
|
307 | 308 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' |
|
308 | 309 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' |
|
309 | 310 | |
|
310 | 311 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
311 | 312 | end |
|
312 | 313 | |
|
313 | 314 | context "wiki (singular, project's pages)" do |
|
314 | 315 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' |
|
315 | 316 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala' |
|
316 | 317 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page' |
|
317 | 318 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation' |
|
318 | 319 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation' |
|
319 | 320 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
320 | 321 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1' |
|
321 | 322 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
322 | 323 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
323 | 324 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' |
|
324 | 325 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' |
|
325 | 326 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' |
|
326 | 327 | |
|
327 | 328 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' |
|
328 | 329 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
329 | 330 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' |
|
330 | 331 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida' |
|
331 | 332 | |
|
332 | 333 | should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page' |
|
333 | 334 | |
|
334 | 335 | should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida' |
|
335 | 336 | end |
|
336 | 337 | |
|
337 | 338 | context "wikis (plural, admin setup)" do |
|
338 | 339 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
339 | 340 | |
|
340 | 341 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
341 | 342 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
342 | 343 | end |
|
343 | 344 | |
|
344 | 345 | context "administration panel" do |
|
345 | 346 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
346 | 347 | end |
|
347 | 348 | end |
General Comments 0
You need to be logged in to leave comments.
Login now