tests: fix broken tests.

This commit is contained in:
evazion
2022-04-18 00:31:31 -05:00
parent cd22c8eb1a
commit 6c5dd5ffed
3 changed files with 5 additions and 3 deletions

View File

@@ -238,7 +238,7 @@ class ApplicationControllerTest < ActionDispatch::IntegrationTest
# try to submit a form with cookies but without the csrf token
put user_path(@user), headers: { HTTP_COOKIE: headers["Set-Cookie"] }, params: { user: { enable_safe_mode: "true" } }
assert_response 403
assert_equal("Can't verify CSRF token authenticity.", css_select("p").first.content)
assert_equal("Error: Can't verify CSRF token authenticity.", css_select("p").first.content)
assert_equal(false, @user.reload.enable_safe_mode)
end
end

View File

@@ -571,7 +571,9 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
end
should "not work for tags without a wiki page" do
create(:tag, name: "no_wiki")
@bur = build(:bulk_update_request, script: "deprecate no_wiki")
assert_equal(false, @bur.valid?)
assert_equal(["Can't deprecate no_wiki (tag must have a wiki page)"], @bur.errors[:base])
end

View File

@@ -1,8 +1,8 @@
require 'test_helper'
class PostQueryBuilderTest < ActiveSupport::TestCase
def assert_tag_match(posts, query, current_user: CurrentUser.user, **options)
assert_equal(posts.map(&:id), Post.user_tag_match(query, current_user, **options).pluck(:id))
def assert_tag_match(posts, query, current_user: CurrentUser.user, tag_limit: nil, **options)
assert_equal(posts.map(&:id), Post.user_tag_match(query, current_user, tag_limit: tag_limit, **options).pluck(:id))
end
def assert_search_error(query, current_user: CurrentUser.user, **options)