X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/19c2b92fb736e2b424981ce36c8ffd8f75c44d99..4b0d56f7e15d2929c973265e3b545e69273b8cb5:/test/controllers/changeset_comments_controller_test.rb diff --git a/test/controllers/changeset_comments_controller_test.rb b/test/controllers/changeset_comments_controller_test.rb index 215f45957..67df9aa88 100644 --- a/test/controllers/changeset_comments_controller_test.rb +++ b/test/controllers/changeset_comments_controller_test.rb @@ -6,7 +6,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase def test_routes assert_routing( { :path => "/api/0.6/changeset/1/comment", :method => :post }, - { :controller => "changeset_comments", :action => "comment", :id => "1" } + { :controller => "changeset_comments", :action => "create", :id => "1" } ) assert_routing( { :path => "/api/0.6/changeset/comment/1/hide", :method => :post }, @@ -18,11 +18,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ) assert_routing( { :path => "/changeset/1/comments/feed", :method => :get }, - { :controller => "changeset_comments", :action => "comments_feed", :id => "1", :format => "rss" } + { :controller => "changeset_comments", :action => "index", :id => "1", :format => "rss" } ) assert_routing( { :path => "/history/comments/feed", :method => :get }, - { :controller => "changeset_comments", :action => "comments_feed", :format => "rss" } + { :controller => "changeset_comments", :action => "index", :format => "rss" } ) end @@ -41,7 +41,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase assert_difference "ChangesetComment.count", 1 do assert_no_difference "ActionMailer::Base.deliveries.size" do perform_enqueued_jobs do - post :comment, :params => { :id => private_user_closed_changeset.id, :text => "This is a comment" } + post :create, :params => { :id => private_user_closed_changeset.id, :text => "This is a comment" } end end end @@ -56,7 +56,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase assert_difference "ChangesetComment.count", 1 do assert_difference "ActionMailer::Base.deliveries.size", 1 do perform_enqueued_jobs do - post :comment, :params => { :id => changeset.id, :text => "This is a comment" } + post :create, :params => { :id => changeset.id, :text => "This is a comment" } end end end @@ -74,7 +74,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase assert_difference "ChangesetComment.count", 1 do assert_difference "ActionMailer::Base.deliveries.size", 2 do perform_enqueued_jobs do - post :comment, :params => { :id => changeset.id, :text => "This is a comment" } + post :create, :params => { :id => changeset.id, :text => "This is a comment" } end end end @@ -97,32 +97,32 @@ class ChangesetCommentsControllerTest < ActionController::TestCase # create comment fail def test_create_comment_fail # unauthorized - post :comment, :params => { :id => create(:changeset, :closed).id, :text => "This is a comment" } + post :create, :params => { :id => create(:changeset, :closed).id, :text => "This is a comment" } assert_response :unauthorized basic_authorization create(:user).email, "test" # bad changeset id assert_no_difference "ChangesetComment.count" do - post :comment, :params => { :id => 999111, :text => "This is a comment" } + post :create, :params => { :id => 999111, :text => "This is a comment" } end assert_response :not_found # not closed changeset assert_no_difference "ChangesetComment.count" do - post :comment, :params => { :id => create(:changeset).id, :text => "This is a comment" } + post :create, :params => { :id => create(:changeset).id, :text => "This is a comment" } end assert_response :conflict # no text assert_no_difference "ChangesetComment.count" do - post :comment, :params => { :id => create(:changeset, :closed).id } + post :create, :params => { :id => create(:changeset, :closed).id } end assert_response :bad_request # empty text assert_no_difference "ChangesetComment.count" do - post :comment, :params => { :id => create(:changeset, :closed).id, :text => "" } + post :create, :params => { :id => create(:changeset, :closed).id, :text => "" } end assert_response :bad_request end @@ -207,11 +207,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ## # test comments feed - def test_comments_feed + def test_feed changeset = create(:changeset, :closed) create_list(:changeset_comment, 3, :changeset => changeset) - get :comments_feed, :params => { :format => "rss" } + get :index, :params => { :format => "rss" } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -220,7 +220,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase end end - get :comments_feed, :params => { :format => "rss", :limit => 2 } + get :index, :params => { :format => "rss", :limit => 2 } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -229,7 +229,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase end end - get :comments_feed, :params => { :id => changeset.id, :format => "rss" } + get :index, :params => { :id => changeset.id, :format => "rss" } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -241,11 +241,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ## # test comments feed - def test_comments_feed_bad_limit - get :comments_feed, :params => { :format => "rss", :limit => 0 } + def test_feed_bad_limit + get :index, :params => { :format => "rss", :limit => 0 } assert_response :bad_request - get :comments_feed, :params => { :format => "rss", :limit => 100001 } + get :index, :params => { :format => "rss", :limit => 100001 } assert_response :bad_request end end