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