1 require File.dirname(__FILE__) + '/../test_helper'
3 class NotesControllerTest < ActionController::TestCase
4 fixtures :users, :notes, :note_comments
7 # test all routes which lead to this controller
10 { :path => "/api/0.6/notes", :method => :post },
11 { :controller => "notes", :action => "create", :format => "xml" }
14 { :path => "/api/0.6/notes/1", :method => :get },
15 { :controller => "notes", :action => "show", :id => "1", :format => "xml" }
18 { :controller => "notes", :action => "show", :id => "1", :format => "xml" },
19 { :path => "/api/0.6/notes/1.xml", :method => :get }
22 { :path => "/api/0.6/notes/1.rss", :method => :get },
23 { :controller => "notes", :action => "show", :id => "1", :format => "rss" }
26 { :path => "/api/0.6/notes/1.json", :method => :get },
27 { :controller => "notes", :action => "show", :id => "1", :format => "json" }
30 { :path => "/api/0.6/notes/1.gpx", :method => :get },
31 { :controller => "notes", :action => "show", :id => "1", :format => "gpx" }
34 { :path => "/api/0.6/notes/1/comment", :method => :post },
35 { :controller => "notes", :action => "comment", :id => "1", :format => "xml" }
38 { :path => "/api/0.6/notes/1/close", :method => :post },
39 { :controller => "notes", :action => "close", :id => "1", :format => "xml" }
42 { :path => "/api/0.6/notes/1/reopen", :method => :post },
43 { :controller => "notes", :action => "reopen", :id => "1", :format => "xml" }
46 { :path => "/api/0.6/notes/1", :method => :delete },
47 { :controller => "notes", :action => "destroy", :id => "1", :format => "xml" }
51 { :path => "/api/0.6/notes", :method => :get },
52 { :controller => "notes", :action => "index", :format => "xml" }
55 { :controller => "notes", :action => "index", :format => "xml" },
56 { :path => "/api/0.6/notes.xml", :method => :get }
59 { :path => "/api/0.6/notes.rss", :method => :get },
60 { :controller => "notes", :action => "index", :format => "rss" }
63 { :path => "/api/0.6/notes.json", :method => :get },
64 { :controller => "notes", :action => "index", :format => "json" }
67 { :path => "/api/0.6/notes.gpx", :method => :get },
68 { :controller => "notes", :action => "index", :format => "gpx" }
72 { :path => "/api/0.6/notes/search", :method => :get },
73 { :controller => "notes", :action => "search", :format => "xml" }
76 { :controller => "notes", :action => "search", :format => "xml" },
77 { :path => "/api/0.6/notes/search.xml", :method => :get }
80 { :path => "/api/0.6/notes/search.rss", :method => :get },
81 { :controller => "notes", :action => "search", :format => "rss" }
84 { :path => "/api/0.6/notes/search.json", :method => :get },
85 { :controller => "notes", :action => "search", :format => "json" }
88 { :path => "/api/0.6/notes/search.gpx", :method => :get },
89 { :controller => "notes", :action => "search", :format => "gpx" }
93 { :path => "/api/0.6/notes/feed", :method => :get },
94 { :controller => "notes", :action => "feed", :format => "rss" }
98 { :controller => "notes", :action => "create" },
99 { :path => "/api/0.6/notes/addPOIexec", :method => :post }
102 { :controller => "notes", :action => "close" },
103 { :path => "/api/0.6/notes/closePOIexec", :method => :post }
106 { :controller => "notes", :action => "comment" },
107 { :path => "/api/0.6/notes/editPOIexec", :method => :post }
110 { :controller => "notes", :action => "index", :format => "gpx" },
111 { :path => "/api/0.6/notes/getGPX", :method => :get }
114 { :controller => "notes", :action => "feed", :format => "rss" },
115 { :path => "/api/0.6/notes/getRSSfeed", :method => :get }
119 { :path => "/user/username/notes", :method => :get },
120 { :controller => "notes", :action => "mine", :display_name => "username" }
124 def test_create_success
125 assert_difference('Note.count') do
126 assert_difference('NoteComment.count') do
127 post :create, {:lat => -1.0, :lon => -1.0, :text => "This is a comment", :format => "json"}
130 assert_response :success
131 js = ActiveSupport::JSON.decode(@response.body)
133 assert_equal "Feature", js["type"]
134 assert_equal "Point", js["geometry"]["type"]
135 assert_equal [-1.0, -1.0], js["geometry"]["coordinates"]
136 assert_equal "open", js["properties"]["status"]
137 assert_equal 1, js["properties"]["comments"].count
138 assert_equal "opened", js["properties"]["comments"].last["action"]
139 assert_equal "This is a comment", js["properties"]["comments"].last["text"]
140 assert_nil js["properties"]["comments"].last["user"]
141 id = js["properties"]["id"]
143 get :show, {:id => id, :format => "json"}
144 assert_response :success
145 js = ActiveSupport::JSON.decode(@response.body)
147 assert_equal "Feature", js["type"]
148 assert_equal "Point", js["geometry"]["type"]
149 assert_equal [-1.0, -1.0], js["geometry"]["coordinates"]
150 assert_equal id, js["properties"]["id"]
151 assert_equal "open", js["properties"]["status"]
152 assert_equal 1, js["properties"]["comments"].count
153 assert_equal "opened", js["properties"]["comments"].last["action"]
154 assert_equal "This is a comment", js["properties"]["comments"].last["text"]
155 assert_nil js["properties"]["comments"].last["user"]
159 assert_no_difference('Note.count') do
160 assert_no_difference('NoteComment.count') do
161 post :create, {:lon => -1.0, :text => "This is a comment"}
164 assert_response :bad_request
166 assert_no_difference('Note.count') do
167 assert_no_difference('NoteComment.count') do
168 post :create, {:lat => -1.0, :text => "This is a comment"}
171 assert_response :bad_request
173 assert_no_difference('Note.count') do
174 assert_no_difference('NoteComment.count') do
175 post :create, {:lat => -1.0, :lon => -1.0}
178 assert_response :bad_request
180 assert_no_difference('Note.count') do
181 assert_no_difference('NoteComment.count') do
182 post :create, {:lat => -1.0, :lon => -1.0, :text => ""}
185 assert_response :bad_request
187 assert_no_difference('Note.count') do
188 assert_no_difference('NoteComment.count') do
189 post :create, {:lat => -100.0, :lon => -1.0, :text => "This is a comment"}
192 assert_response :bad_request
194 assert_no_difference('Note.count') do
195 assert_no_difference('NoteComment.count') do
196 post :create, {:lat => -1.0, :lon => -200.0, :text => "This is a comment"}
199 assert_response :bad_request
202 def test_comment_success
203 assert_difference('NoteComment.count') do
204 post :comment, {:id => notes(:open_note_with_comment).id, :text => "This is an additional comment", :format => "json"}
206 assert_response :success
207 js = ActiveSupport::JSON.decode(@response.body)
209 assert_equal "Feature", js["type"]
210 assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
211 assert_equal "open", js["properties"]["status"]
212 assert_equal 3, js["properties"]["comments"].count
213 assert_equal "commented", js["properties"]["comments"].last["action"]
214 assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
215 assert_nil js["properties"]["comments"].last["user"]
217 get :show, {:id => notes(:open_note_with_comment).id, :format => "json"}
218 assert_response :success
219 js = ActiveSupport::JSON.decode(@response.body)
221 assert_equal "Feature", js["type"]
222 assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
223 assert_equal "open", js["properties"]["status"]
224 assert_equal 3, js["properties"]["comments"].count
225 assert_equal "commented", js["properties"]["comments"].last["action"]
226 assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
227 assert_nil js["properties"]["comments"].last["user"]
230 def test_comment_fail
231 assert_no_difference('NoteComment.count') do
232 post :comment, {:text => "This is an additional comment"}
234 assert_response :bad_request
236 assert_no_difference('NoteComment.count') do
237 post :comment, {:id => notes(:open_note_with_comment).id}
239 assert_response :bad_request
241 assert_no_difference('NoteComment.count') do
242 post :comment, {:id => notes(:open_note_with_comment).id, :text => ""}
244 assert_response :bad_request
246 assert_no_difference('NoteComment.count') do
247 post :comment, {:id => 12345, :text => "This is an additional comment"}
249 assert_response :not_found
251 assert_no_difference('NoteComment.count') do
252 post :comment, {:id => notes(:hidden_note_with_comment).id, :text => "This is an additional comment"}
254 assert_response :gone
256 assert_no_difference('NoteComment.count') do
257 post :comment, {:id => notes(:closed_note_with_comment).id, :text => "This is an additional comment"}
259 assert_response :conflict
262 def test_close_success
263 post :close, {:id => notes(:open_note_with_comment).id, :text => "This is a close comment", :format => "json"}
264 assert_response :unauthorized
266 basic_authorization(users(:public_user).email, "test")
268 post :close, {:id => notes(:open_note_with_comment).id, :text => "This is a close comment", :format => "json"}
269 assert_response :success
270 js = ActiveSupport::JSON.decode(@response.body)
272 assert_equal "Feature", js["type"]
273 assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
274 assert_equal "closed", js["properties"]["status"]
275 assert_equal 3, js["properties"]["comments"].count
276 assert_equal "closed", js["properties"]["comments"].last["action"]
277 assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
278 assert_equal "test2", js["properties"]["comments"].last["user"]
280 get :show, {:id => notes(:open_note_with_comment).id, :format => "json"}
281 assert_response :success
282 js = ActiveSupport::JSON.decode(@response.body)
284 assert_equal "Feature", js["type"]
285 assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
286 assert_equal "closed", js["properties"]["status"]
287 assert_equal 3, js["properties"]["comments"].count
288 assert_equal "closed", js["properties"]["comments"].last["action"]
289 assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
290 assert_equal "test2", js["properties"]["comments"].last["user"]
295 assert_response :unauthorized
297 basic_authorization(users(:public_user).email, "test")
300 assert_response :bad_request
302 post :close, {:id => 12345}
303 assert_response :not_found
305 post :close, {:id => notes(:hidden_note_with_comment).id}
306 assert_response :gone
308 post :close, {:id => notes(:closed_note_with_comment).id}
309 assert_response :conflict
312 def test_reopen_success
313 post :reopen, {:id => notes(:closed_note_with_comment).id, :text => "This is a reopen comment", :format => "json"}
314 assert_response :unauthorized
316 basic_authorization(users(:public_user).email, "test")
318 post :reopen, {:id => notes(:closed_note_with_comment).id, :text => "This is a reopen comment", :format => "json"}
319 assert_response :success
320 js = ActiveSupport::JSON.decode(@response.body)
322 assert_equal "Feature", js["type"]
323 assert_equal notes(:closed_note_with_comment).id, js["properties"]["id"]
324 assert_equal "open", js["properties"]["status"]
325 assert_equal 2, js["properties"]["comments"].count
326 assert_equal "reopened", js["properties"]["comments"].last["action"]
327 assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
328 assert_equal "test2", js["properties"]["comments"].last["user"]
330 get :show, {:id => notes(:closed_note_with_comment).id, :format => "json"}
331 assert_response :success
332 js = ActiveSupport::JSON.decode(@response.body)
334 assert_equal "Feature", js["type"]
335 assert_equal notes(:closed_note_with_comment).id, js["properties"]["id"]
336 assert_equal "open", js["properties"]["status"]
337 assert_equal 2, js["properties"]["comments"].count
338 assert_equal "reopened", js["properties"]["comments"].last["action"]
339 assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
340 assert_equal "test2", js["properties"]["comments"].last["user"]
344 post :reopen, {:id => notes(:hidden_note_with_comment).id}
345 assert_response :unauthorized
347 basic_authorization(users(:public_user).email, "test")
349 post :reopen, {:id => 12345}
350 assert_response :not_found
352 post :reopen, {:id => notes(:hidden_note_with_comment).id}
353 assert_response :gone
355 post :reopen, {:id => notes(:open_note_with_comment).id}
356 assert_response :conflict
359 def test_show_success
360 get :show, {:id => notes(:open_note).id, :format => "xml"}
361 assert_response :success
362 assert_equal "application/xml", @response.content_type
363 assert_select "osm", :count => 1 do
364 assert_select "note[lat=#{notes(:open_note).lat}][lon=#{notes(:open_note).lon}]", :count => 1 do
365 assert_select "id", notes(:open_note).id
366 assert_select "url", note_url(notes(:open_note), :format => "xml")
367 assert_select "comment_url", comment_note_url(notes(:open_note), :format => "xml")
368 assert_select "close_url", close_note_url(notes(:open_note), :format => "xml")
369 assert_select "date_created", notes(:open_note).created_at.to_s
370 assert_select "status", notes(:open_note).status
371 assert_select "comments", :count => 1 do
372 assert_select "comment", :count => 1
377 get :show, {:id => notes(:open_note).id, :format => "rss"}
378 assert_response :success
379 assert_equal "application/rss+xml", @response.content_type
380 assert_select "rss", :count => 1 do
381 assert_select "channel", :count => 1 do
382 assert_select "item", :count => 1 do
383 assert_select "link", browse_note_url(notes(:open_note))
384 assert_select "guid", note_url(notes(:open_note))
385 assert_select "pubDate", notes(:open_note).created_at.to_s(:rfc822)
386 # assert_select "geo:lat", notes(:open_note).lat.to_s
387 # assert_select "geo:long", notes(:open_note).lon
388 # assert_select "georss:point", "#{notes(:open_note).lon} #{notes(:open_note).lon}"
393 get :show, {:id => notes(:open_note).id, :format => "json"}
394 assert_response :success
395 assert_equal "application/json", @response.content_type
396 js = ActiveSupport::JSON.decode(@response.body)
398 assert_equal "Feature", js["type"]
399 assert_equal "Point", js["geometry"]["type"]
400 assert_equal notes(:open_note).lat, js["geometry"]["coordinates"][0]
401 assert_equal notes(:open_note).lon, js["geometry"]["coordinates"][1]
402 assert_equal notes(:open_note).id, js["properties"]["id"]
403 assert_equal note_url(notes(:open_note), :format => "json"), js["properties"]["url"]
404 assert_equal comment_note_url(notes(:open_note), :format => "json"), js["properties"]["comment_url"]
405 assert_equal close_note_url(notes(:open_note), :format => "json"), js["properties"]["close_url"]
406 assert_equal notes(:open_note).created_at, js["properties"]["date_created"]
407 assert_equal notes(:open_note).status, js["properties"]["status"]
409 get :show, {:id => notes(:open_note).id, :format => "gpx"}
410 assert_response :success
411 assert_equal "application/gpx+xml", @response.content_type
412 assert_select "gpx", :count => 1 do
413 assert_select "wpt[lat=#{notes(:open_note).lat}][lon=#{notes(:open_note).lon}]", :count => 1 do
414 assert_select "extension", :count => 1 do
415 assert_select "id", notes(:open_note).id
416 assert_select "url", note_url(notes(:open_note), :format => "gpx")
417 assert_select "comment_url", comment_note_url(notes(:open_note), :format => "gpx")
418 assert_select "close_url", close_note_url(notes(:open_note), :format => "gpx")
424 def test_show_hidden_comment
425 get :show, {:id => notes(:note_with_hidden_comment).id, :format => "json"}
426 assert_response :success
427 js = ActiveSupport::JSON.decode(@response.body)
429 assert_equal "Feature", js["type"]
430 assert_equal notes(:note_with_hidden_comment).id, js["properties"]["id"]
431 assert_equal 2, js["properties"]["comments"].count
432 assert_equal "Valid comment for note 5", js["properties"]["comments"][0]["text"]
433 assert_equal "Another valid comment for note 5", js["properties"]["comments"][1]["text"]
437 get :show, {:id => 12345}
438 assert_response :not_found
440 get :show, {:id => notes(:hidden_note_with_comment).id}
441 assert_response :gone
444 def test_destroy_success
445 delete :destroy, {:id => notes(:open_note_with_comment).id, :text => "This is a hide comment", :format => "json"}
446 assert_response :unauthorized
448 basic_authorization(users(:public_user).email, "test")
450 delete :destroy, {:id => notes(:open_note_with_comment).id, :text => "This is a hide comment", :format => "json"}
451 assert_response :forbidden
453 basic_authorization(users(:moderator_user).email, "test")
455 delete :destroy, {:id => notes(:open_note_with_comment).id, :text => "This is a hide comment", :format => "json"}
456 assert_response :success
457 js = ActiveSupport::JSON.decode(@response.body)
459 assert_equal "Feature", js["type"]
460 assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
461 assert_equal "hidden", js["properties"]["status"]
462 assert_equal 3, js["properties"]["comments"].count
463 assert_equal "hidden", js["properties"]["comments"].last["action"]
464 assert_equal "This is a hide comment", js["properties"]["comments"].last["text"]
465 assert_equal "moderator", js["properties"]["comments"].last["user"]
467 get :show, {:id => notes(:open_note_with_comment).id, :format => 'json'}
468 assert_response :gone
471 def test_destroy_fail
472 delete :destroy, {:id => 12345, :format => "json"}
473 assert_response :unauthorized
475 basic_authorization(users(:public_user).email, "test")
477 delete :destroy, {:id => 12345, :format => "json"}
478 assert_response :forbidden
480 basic_authorization(users(:moderator_user).email, "test")
482 delete :destroy, {:id => 12345, :format => "json"}
483 assert_response :not_found
485 delete :destroy, {:id => notes(:hidden_note_with_comment).id, :format => "json"}
486 assert_response :gone
489 def test_index_success
490 get :index, {:bbox => '1,1,1.2,1.2', :format => 'rss'}
491 assert_response :success
492 assert_equal "application/rss+xml", @response.content_type
493 assert_select "rss", :count => 1 do
494 assert_select "channel", :count => 1 do
495 assert_select "item", :count => 2
499 get :index, {:bbox => '1,1,1.2,1.2', :format => 'json'}
500 assert_response :success
501 assert_equal "application/json", @response.content_type
502 js = ActiveSupport::JSON.decode(@response.body)
504 assert_equal "FeatureCollection", js["type"]
505 assert_equal 2, js["features"].count
507 get :index, {:bbox => '1,1,1.2,1.2', :format => 'xml'}
508 assert_response :success
509 assert_equal "application/xml", @response.content_type
510 assert_select "osm", :count => 1 do
511 assert_select "note", :count => 2
514 get :index, {:bbox => '1,1,1.2,1.2', :format => 'gpx'}
515 assert_response :success
516 assert_equal "application/gpx+xml", @response.content_type
517 assert_select "gpx", :count => 1 do
518 assert_select "wpt", :count => 2
522 def test_index_empty_area
523 get :index, {:bbox => '5,5,5.1,5.1', :format => 'rss'}
524 assert_response :success
525 assert_equal "application/rss+xml", @response.content_type
526 assert_select "rss", :count => 1 do
527 assert_select "channel", :count => 1 do
528 assert_select "item", :count => 0
532 get :index, {:bbox => '5,5,5.1,5.1', :format => 'json'}
533 assert_response :success
534 assert_equal "application/json", @response.content_type
535 js = ActiveSupport::JSON.decode(@response.body)
537 assert_equal "FeatureCollection", js["type"]
538 assert_equal 0, js["features"].count
540 get :index, {:bbox => '5,5,5.1,5.1', :format => 'xml'}
541 assert_response :success
542 assert_equal "application/xml", @response.content_type
543 assert_select "osm", :count => 1 do
544 assert_select "note", :count => 0
547 get :index, {:bbox => '5,5,5.1,5.1', :format => 'gpx'}
548 assert_response :success
549 assert_equal "application/gpx+xml", @response.content_type
550 assert_select "gpx", :count => 1 do
551 assert_select "wpt", :count => 0
555 def test_index_large_area
556 get :index, {:bbox => '-2.5,-2.5,2.5,2.5', :format => :json}
557 assert_response :success
558 assert_equal "application/json", @response.content_type
560 get :index, {:l => '-2.5', :b => '-2.5', :r => '2.5', :t => '2.5', :format => :json}
561 assert_response :success
562 assert_equal "application/json", @response.content_type
564 get :index, {:bbox => '-10,-10,12,12', :format => :json}
565 assert_response :bad_request
566 assert_equal "text/plain", @response.content_type
568 get :index, {:l => '-10', :b => '-10', :r => '12', :t => '12', :format => :json}
569 assert_response :bad_request
570 assert_equal "text/plain", @response.content_type
573 def test_index_closed
574 get :index, {:bbox => '1,1,1.7,1.7', :closed => '7', :format => 'json'}
575 assert_response :success
576 assert_equal "application/json", @response.content_type
577 js = ActiveSupport::JSON.decode(@response.body)
579 assert_equal "FeatureCollection", js["type"]
580 assert_equal 4, js["features"].count
582 get :index, {:bbox => '1,1,1.7,1.7', :closed => '0', :format => 'json'}
583 assert_response :success
584 assert_equal "application/json", @response.content_type
585 js = ActiveSupport::JSON.decode(@response.body)
587 assert_equal "FeatureCollection", js["type"]
588 assert_equal 4, js["features"].count
590 get :index, {:bbox => '1,1,1.7,1.7', :closed => '-1', :format => 'json'}
591 assert_response :success
592 assert_equal "application/json", @response.content_type
593 js = ActiveSupport::JSON.decode(@response.body)
595 assert_equal "FeatureCollection", js["type"]
596 assert_equal 6, js["features"].count
599 def test_index_bad_params
600 get :index, {:bbox => '-2.5,-2.5,2.5'}
601 assert_response :bad_request
603 get :index, {:bbox => '-2.5,-2.5,2.5,2.5,2.5'}
604 assert_response :bad_request
606 get :index, {:b => '-2.5', :r => '2.5', :t => '2.5'}
607 assert_response :bad_request
609 get :index, {:l => '-2.5', :r => '2.5', :t => '2.5'}
610 assert_response :bad_request
612 get :index, {:l => '-2.5', :b => '-2.5', :t => '2.5'}
613 assert_response :bad_request
615 get :index, {:l => '-2.5', :b => '-2.5', :r => '2.5'}
616 assert_response :bad_request
619 def test_search_success
620 get :search, {:q => 'note 1', :format => 'xml'}
621 assert_response :success
622 assert_equal "application/xml", @response.content_type
623 assert_select "osm", :count => 1 do
624 assert_select "note", :count => 1
627 get :search, {:q => 'note 1', :format => 'json'}
628 assert_response :success
629 assert_equal "application/json", @response.content_type
630 js = ActiveSupport::JSON.decode(@response.body)
632 assert_equal "FeatureCollection", js["type"]
633 assert_equal 1, js["features"].count
635 get :search, {:q => 'note 1', :format => 'rss'}
636 assert_response :success
637 assert_equal "application/rss+xml", @response.content_type
638 assert_select "rss", :count => 1 do
639 assert_select "channel", :count => 1 do
640 assert_select "item", :count => 1
644 get :search, {:q => 'note 1', :format => 'gpx'}
645 assert_response :success
646 assert_equal "application/gpx+xml", @response.content_type
647 assert_select "gpx", :count => 1 do
648 assert_select "wpt", :count => 1
652 def test_search_no_match
653 get :search, {:q => 'no match', :format => 'xml'}
654 assert_response :success
655 assert_equal "application/xml", @response.content_type
656 assert_select "osm", :count => 1 do
657 assert_select "note", :count => 0
660 get :search, {:q => 'no match', :format => 'json'}
661 assert_response :success
662 assert_equal "application/json", @response.content_type
663 js = ActiveSupport::JSON.decode(@response.body)
665 assert_equal "FeatureCollection", js["type"]
666 assert_equal 0, js["features"].count
668 get :search, {:q => 'no match', :format => 'rss'}
669 assert_response :success
670 assert_equal "application/rss+xml", @response.content_type
671 assert_select "rss", :count => 1 do
672 assert_select "channel", :count => 1 do
673 assert_select "item", :count => 0
677 get :search, {:q => 'no match', :format => 'gpx'}
678 assert_response :success
679 assert_equal "application/gpx+xml", @response.content_type
680 assert_select "gpx", :count => 1 do
681 assert_select "wpt", :count => 0
685 def test_search_bad_params
687 assert_response :bad_request
690 def test_feed_success
691 get :feed, {:format => "rss"}
692 assert_response :success
693 assert_equal "application/rss+xml", @response.content_type
694 assert_select "rss", :count => 1 do
695 assert_select "channel", :count => 1 do
696 assert_select "item", :count => 8
700 get :feed, {:bbox => "1,1,1.2,1.2", :format => "rss"}
701 assert_response :success
702 assert_equal "application/rss+xml", @response.content_type
703 assert_select "rss", :count => 1 do
704 assert_select "channel", :count => 1 do
705 assert_select "item", :count => 3
711 get :feed, {:bbox => "1,1,1.2"}
712 assert_response :bad_request
714 get :feed, {:bbox => "1,1,1.2,1.2,1.2"}
715 assert_response :bad_request
718 def test_mine_success
719 get :mine, {:display_name => "test"}
720 assert_response :success
722 get :mine, {:display_name => "pulibc_test2"}
723 assert_response :success
725 get :mine, {:display_name => "non-existent"}
726 assert_response :not_found