X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/341f6cd9feed774f0abdb337f36272d5ecc92549..a66f0f32e977cb2d6ae7231e7014861c119cc657:/test/controllers/changeset_controller_test.rb
diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb
index 5b1dfdbe4..a9a838aff 100644
--- a/test/controllers/changeset_controller_test.rb
+++ b/test/controllers/changeset_controller_test.rb
@@ -3,7 +3,7 @@ require "changeset_controller"
class ChangesetControllerTest < ActionController::TestCase
api_fixtures
- fixtures :friends, :changeset_comments, :changesets_subscribers
+ fixtures :changesets_subscribers
##
# test all routes which lead to this controller
@@ -197,6 +197,7 @@ class ChangesetControllerTest < ActionController::TestCase
assert_select "osm>changeset>discussion>comment", 0
changeset_id = changesets(:normal_user_closed_change).id
+ create_list(:changeset_comment, 3, :changeset_id => changeset_id)
get :read, :id => changeset_id, :include_discussion => true
assert_response :success, "cannot get closed changeset with comments"
@@ -675,7 +676,7 @@ EOF
-
+
@@ -1181,8 +1182,7 @@ EOF
["",
"",
"",
- ""
- ].each do |diff|
+ ""].each do |diff|
# upload it
content diff
post :upload, :id => changesets(:public_user_first_change).id
@@ -1598,8 +1598,7 @@ EOF
def test_query_invalid
["abracadabra!",
"1,2,3,F",
- ";drop table users;"
- ].each do |bbox|
+ ";drop table users;"].each do |bbox|
get :query, :bbox => bbox
assert_response :bad_request, "'#{bbox}' isn't a bbox"
end
@@ -1608,8 +1607,7 @@ EOF
"00-00-00",
";drop table users;",
",",
- "-,-"
- ].each do |time|
+ "-,-"].each do |time|
get :query, :time => time
assert_response :bad_request, "'#{time}' isn't a valid time range"
end
@@ -1617,8 +1615,7 @@ EOF
["me",
"foobar",
"-1",
- "0"
- ].each do |uid|
+ "0"].each do |uid|
get :query, :user => uid
assert_response :bad_request, "'#{uid}' isn't a valid user ID"
end
@@ -2153,7 +2150,7 @@ EOF
# test hide comment fail
def test_hide_comment_fail
# unauthorized
- comment = changeset_comments(:normal_comment_1)
+ comment = create(:changeset_comment)
assert_equal true, comment.visible
post :hide_comment, :id => comment.id
@@ -2178,7 +2175,7 @@ EOF
##
# test hide comment succes
def test_hide_comment_success
- comment = changeset_comments(:normal_comment_1)
+ comment = create(:changeset_comment)
assert_equal true, comment.visible
basic_authorization(users(:moderator_user).email, "test")
@@ -2192,7 +2189,7 @@ EOF
# test unhide comment fail
def test_unhide_comment_fail
# unauthorized
- comment = changeset_comments(:hidden_comment)
+ comment = create(:changeset_comment, :visible => false)
assert_equal false, comment.visible
post :unhide_comment, :id => comment.id
@@ -2217,7 +2214,7 @@ EOF
##
# test unhide comment succes
def test_unhide_comment_success
- comment = changeset_comments(:hidden_comment)
+ comment = create(:changeset_comment, :visible => false)
assert_equal false, comment.visible
basic_authorization(users(:moderator_user).email, "test")
@@ -2230,6 +2227,8 @@ EOF
##
# test comments feed
def test_comments_feed
+ create_list(:changeset_comment, 3, :changeset_id => changesets(:normal_user_closed_change).id)
+
get :comments_feed, :format => "rss"
assert_response :success
assert_equal "application/rss+xml", @response.content_type
@@ -2339,10 +2338,11 @@ EOF
assert changesets.size <= 20
assert_select "feed", :count => [changesets.size, 1].min do
- assert_select "entry", :count => changesets.size
+ assert_select "> title", :count => 1, :text => /^Changesets/
+ assert_select "> entry", :count => changesets.size
changesets.each do |changeset|
- assert_select "entry > id", changeset_url(:id => changeset.id)
+ assert_select "> entry > id", changeset_url(:id => changeset.id)
end
end
end