tests: fix test failures in #4553.
This commit is contained in:
@@ -2,31 +2,33 @@ require 'test_helper'
|
|||||||
|
|
||||||
class ModActionsControllerTest < ActionDispatch::IntegrationTest
|
class ModActionsControllerTest < ActionDispatch::IntegrationTest
|
||||||
context "The mod actions controller" do
|
context "The mod actions controller" do
|
||||||
setup do
|
|
||||||
@mod_action = create(:mod_action, description: "blah", category: "post_delete")
|
|
||||||
end
|
|
||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
setup do
|
|
||||||
@ban = create(:mod_action, category: :post_ban)
|
|
||||||
@unban = create(:mod_action, category: :post_unban)
|
|
||||||
end
|
|
||||||
|
|
||||||
should "work" do
|
should "work" do
|
||||||
|
create(:mod_action)
|
||||||
get mod_actions_path
|
get mod_actions_path
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
should respond_to_search({}).with { [@unrelated_action, @promote_action, @mod_action] }
|
context "searching" do
|
||||||
should respond_to_search(category: ModAction.categories["user_level_change"]).with { @promote_action }
|
setup do
|
||||||
should respond_to_search(description_matches: "blah").with { @mod_action }
|
@mod_action = create(:mod_action, description: "blah")
|
||||||
|
@promote_action = create(:mod_action, category: "user_level_change", creator: create(:builder_user, name: "rumia"))
|
||||||
|
end
|
||||||
|
|
||||||
|
should respond_to_search({}).with { [@promote_action, @mod_action] }
|
||||||
|
should respond_to_search(category: ModAction.categories["user_level_change"].to_s).with { @promote_action }
|
||||||
|
should respond_to_search(description_matches: "blah").with { @mod_action }
|
||||||
|
|
||||||
context "using includes" do
|
|
||||||
should respond_to_search(creator_name: "rumia").with { @promote_action }
|
should respond_to_search(creator_name: "rumia").with { @promote_action }
|
||||||
should respond_to_search(creator: {level: User::Levels::BUILDER}).with { @promote_action }
|
should respond_to_search(creator: { level: User::Levels::BUILDER }).with { @promote_action }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "category enum searches" do
|
context "category enum searches" do
|
||||||
|
setup do
|
||||||
|
@ban = create(:mod_action, category: :post_ban)
|
||||||
|
@unban = create(:mod_action, category: :post_unban)
|
||||||
|
end
|
||||||
|
|
||||||
should respond_to_search(category: "post_ban").with { [@ban] }
|
should respond_to_search(category: "post_ban").with { [@ban] }
|
||||||
should respond_to_search(category: "post_unban").with { [@unban] }
|
should respond_to_search(category: "post_unban").with { [@unban] }
|
||||||
should respond_to_search(category: "Post_ban").with { [@ban] }
|
should respond_to_search(category: "Post_ban").with { [@ban] }
|
||||||
@@ -36,7 +38,6 @@ class ModActionsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
should respond_to_search(category_id: "44").with { [@ban] }
|
should respond_to_search(category_id: "44").with { [@ban] }
|
||||||
should respond_to_search(category_id: "44,45").with { [@unban, @ban] }
|
should respond_to_search(category_id: "44,45").with { [@unban, @ban] }
|
||||||
should respond_to_search(category_id: ">=44").with { [@unban, @ban] }
|
should respond_to_search(category_id: ">=44").with { [@unban, @ban] }
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class PostAppealsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
should respond_to_search({}).with { [@resolved_appeal, @unrelated_appeal, @post_appeal] }
|
should respond_to_search({}).with { [@resolved_appeal, @unrelated_appeal, @post_appeal] }
|
||||||
should respond_to_search(reason_matches: "Good.").with { @unrelated_appeal }
|
should respond_to_search(reason_matches: "Good.").with { @unrelated_appeal }
|
||||||
should respond_to_search(is_resolved: "true").with { @resolved_appeal }
|
|
||||||
|
|
||||||
context "using includes" do
|
context "using includes" do
|
||||||
should respond_to_search(post_id: 101).with { @post_appeal }
|
should respond_to_search(post_id: 101).with { @post_appeal }
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
setup do
|
setup do
|
||||||
@first_user = User.find(1)
|
|
||||||
@mod_user = create(:moderator_user, name: "yukari")
|
@mod_user = create(:moderator_user, name: "yukari")
|
||||||
@other_user = create(:builder_user, can_upload_free: true, inviter: @mod_user, created_at: 2.weeks.ago)
|
@other_user = create(:builder_user, can_upload_free: true, inviter: @mod_user, created_at: 2.weeks.ago)
|
||||||
@uploader = create(:user, created_at: 2.weeks.ago)
|
@uploader = create(:user, created_at: 2.weeks.ago)
|
||||||
@@ -35,8 +34,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_response 404
|
assert_response 404
|
||||||
end
|
end
|
||||||
|
|
||||||
should respond_to_search({}).with { [@uploader, @other_user, @mod_user, @user, @first_user] }
|
should respond_to_search({}).with { [@uploader, @other_user, @mod_user, @user, User.system] }
|
||||||
should respond_to_search(min_level: User::Levels::BUILDER).with { [@other_user, @mod_user, @first_user] }
|
should respond_to_search(min_level: User::Levels::BUILDER).with { [@other_user, @mod_user, User.system] }
|
||||||
should respond_to_search(can_upload_free: "true").with { @other_user }
|
should respond_to_search(can_upload_free: "true").with { @other_user }
|
||||||
should respond_to_search(name_matches: "yukari").with { @mod_user }
|
should respond_to_search(name_matches: "yukari").with { @mod_user }
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
as (@other_user) do
|
as (@other_user) do
|
||||||
@other_post = create(:post, rating: "e", uploader: @other_user)
|
@other_post = create(:post, rating: "e", uploader: @other_user)
|
||||||
create(:post_appeal, creator: @other_user, post: @post)
|
create(:post_appeal, creator: @other_user)
|
||||||
create(:comment, creator: @other_user, post: @other_post)
|
create(:comment, creator: @other_user, post: @other_post)
|
||||||
create(:forum_post_vote, creator: @other_user, forum_post: @forum)
|
create(:forum_post_vote, creator: @other_user, forum_post: @forum)
|
||||||
create(:tag_alias, creator: @other_user)
|
create(:tag_alias, creator: @other_user)
|
||||||
|
|||||||
Reference in New Issue
Block a user