tests: fixup tests.
This commit is contained in:
@@ -21,7 +21,8 @@ class TagsController < ApplicationController
|
||||
@tags = Tag.names_matches_with_aliases(params[:search][:name_matches])
|
||||
end
|
||||
|
||||
respond_with(@tags, root: "tags")
|
||||
# XXX
|
||||
respond_with(@tags.map(&:attributes))
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -235,6 +235,7 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:only] ||= []
|
||||
options[:include] ||= []
|
||||
options[:methods] ||= []
|
||||
|
||||
@@ -17,12 +17,11 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest
|
||||
context "#create.json" do
|
||||
should "create a vote" do
|
||||
assert_difference("CommentVote.count", 1) do
|
||||
post_auth comment_votes_path(comment_id: @comment.id, score: "down", format: "json"), @user
|
||||
post_auth comment_votes_path(comment_id: @comment.id, score: "down"), @user, as: :json
|
||||
assert_response :success
|
||||
|
||||
comment = JSON.parse(@response.body)
|
||||
assert_equal(@comment.id, comment["id"])
|
||||
assert_equal(-1, comment["score"])
|
||||
assert_equal(@comment.id, response.parsed_body["id"])
|
||||
assert_equal(-1, response.parsed_body["score"])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ForumTopicsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
should "not allow users to see the topic" do
|
||||
get_auth forum_topic_path(@forum_topic), @user
|
||||
assert_redirected_to forum_topics_path
|
||||
assert_response 403
|
||||
end
|
||||
|
||||
should "not bump the forum for users without access" do
|
||||
|
||||
@@ -87,7 +87,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
||||
get_auth profile_path, @user, as: :json
|
||||
assert_response :success
|
||||
|
||||
assert_equal(@user.upload_limit, response.parsed_body["upload_limit"])
|
||||
assert_equal(@user.comment_count, response.parsed_body["comment_count"])
|
||||
end
|
||||
|
||||
should "redirect anonymous users to the sign in page" do
|
||||
|
||||
@@ -875,6 +875,7 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
should "not delete the original files" do
|
||||
begin
|
||||
skip unless PixivUgoiraConverter.enabled?
|
||||
@post.unstub(:queue_delete_files)
|
||||
|
||||
# this is called thrice to delete the file for 62247364
|
||||
FileUtils.expects(:rm_f).times(3)
|
||||
@@ -891,9 +892,9 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
assert_nothing_raised { @post.file(:original) }
|
||||
assert_nothing_raised { @post.file(:preview) }
|
||||
|
||||
travel_to((PostReplacement::DELETION_GRACE_PERIOD + 1).days.from_now) do
|
||||
perform_enqueued_jobs
|
||||
end
|
||||
assert_enqueued_jobs 3, only: DeletePostFilesJob
|
||||
travel PostReplacement::DELETION_GRACE_PERIOD + 1.day
|
||||
assert_raise(Post::DeletionError) { perform_enqueued_jobs }
|
||||
|
||||
assert_nothing_raised { @post.file(:original) }
|
||||
assert_nothing_raised { @post.file(:preview) }
|
||||
|
||||
Reference in New Issue
Block a user