@@ -164,6 +164,17 class WatchersControllerTest < ActionController::TestCase | |||
|
164 | 164 | assert_select 'input[name=?][value=9]', 'watcher[user_ids][]' |
|
165 | 165 | end |
|
166 | 166 | |
|
167 | def test_search_non_member_on_create | |
|
168 | @request.session[:user_id] = 2 | |
|
169 | project = Project.find_by_name("ecookbook") | |
|
170 | user = User.generate!(:firstname => 'issue15622') | |
|
171 | membership = user.membership(project) | |
|
172 | assert_nil membership | |
|
173 | xhr :get, :autocomplete_for_user, :q => 'issue15622', :project_id => 'ecookbook' | |
|
174 | assert_response :success | |
|
175 | assert_select 'input', :count => 1 | |
|
176 | end | |
|
177 | ||
|
167 | 178 | def test_autocomplete_on_watchable_update |
|
168 | 179 | @request.session[:user_id] = 2 |
|
169 | 180 | xhr :get, :autocomplete_for_user, :q => 'mi', :object_id => '2', |
@@ -175,6 +186,26 class WatchersControllerTest < ActionController::TestCase | |||
|
175 | 186 | assert_select 'input[name=?][value=9]', 'watcher[user_ids][]' |
|
176 | 187 | end |
|
177 | 188 | |
|
189 | def test_search_and_add_non_member_on_update | |
|
190 | @request.session[:user_id] = 2 | |
|
191 | project = Project.find_by_name("ecookbook") | |
|
192 | user = User.generate!(:firstname => 'issue15622') | |
|
193 | membership = user.membership(project) | |
|
194 | assert_nil membership | |
|
195 | xhr :get, :autocomplete_for_user, :q => 'issue15622', :object_id => '2', | |
|
196 | :object_type => 'issue', :project_id => 'ecookbook' | |
|
197 | assert_response :success | |
|
198 | assert_select 'input', :count => 1 | |
|
199 | assert_difference('Watcher.count', 1) do | |
|
200 | xhr :post, :create, :object_type => 'issue', :object_id => '2', | |
|
201 | :watcher => {:user_ids => ["#{user.id}"]} | |
|
202 | assert_response :success | |
|
203 | assert_match /watchers/, response.body | |
|
204 | assert_match /ajax-modal/, response.body | |
|
205 | end | |
|
206 | assert Issue.find(2).watched_by?(user) | |
|
207 | end | |
|
208 | ||
|
178 | 209 | def test_append |
|
179 | 210 | @request.session[:user_id] = 2 |
|
180 | 211 | assert_no_difference 'Watcher.count' do |
General Comments 0
You need to be logged in to leave comments.
Login now