diff --git a/app/controllers/modqueue_controller.rb b/app/controllers/modqueue_controller.rb index 1255a1dac..f4744b592 100644 --- a/app/controllers/modqueue_controller.rb +++ b/app/controllers/modqueue_controller.rb @@ -23,6 +23,6 @@ class ModqueueController < ApplicationController @preview_size = params[:size].presence || cookies[:post_preview_size].presence || PostPreviewComponent::DEFAULT_SIZE - respond_with(@posts) + respond_with(@posts, model: "Post") end end diff --git a/test/functional/modqueue_controller_test.rb b/test/functional/modqueue_controller_test.rb index 8312ea051..9fabcac44 100644 --- a/test/functional/modqueue_controller_test.rb +++ b/test/functional/modqueue_controller_test.rb @@ -5,7 +5,7 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin_user) @user = create(:user) - @post = as(@user) { create(:post, is_pending: true) } + @post = create(:post, is_pending: true) end context "index action" do @@ -14,6 +14,18 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest assert_response :success end + should "render for a json response" do + get_auth modqueue_index_path, @admin, as: :json + assert_response :success + end + + should "support the only= URL param" do + get_auth modqueue_index_path(only: "rating"), @admin, as: :json + + assert_response :success + assert_equal([{ "rating" => @post.rating }], response.parsed_body) + end + should "include appealed posts in the modqueue" do @appeal = create(:post_appeal) get_auth modqueue_index_path, @admin