tests: fix broken tests.
This commit is contained in:
@@ -131,7 +131,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def file(type = :original)
|
||||
media_asset.variant(type).open_file
|
||||
media_asset.variant(type).open_file!
|
||||
end
|
||||
|
||||
def tagged_file_url(tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FactoryBot.define do
|
||||
factory(:post_disapproval) do
|
||||
user factory: :moderator_user
|
||||
user factory: :approver_user
|
||||
post factory: :post, is_pending: true
|
||||
reason { PostDisapproval::REASONS.sample }
|
||||
message { FFaker::Lorem.sentence }
|
||||
|
||||
@@ -10,7 +10,7 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest
|
||||
context "show action" do
|
||||
context "with a url parameter" do
|
||||
should "render a response" do
|
||||
@url = "https://google.com"
|
||||
@url = "https://danbooru.donmai.us/images/flash-preview.png"
|
||||
@matches = [{ post_id: @post.id, score: 95.0 }]
|
||||
mock_iqdb_matches(@matches)
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@ class PostDisapprovalsControllerTest < ActionDispatch::IntegrationTest
|
||||
should "allow mods to see disapprover names" do
|
||||
get_auth post_disapprovals_path, create(:mod_user)
|
||||
assert_response :success
|
||||
assert_select "tr#post-disapproval-#{@post_disapproval.id} .created-column a.user-post-approver", true
|
||||
assert_select "tr#post-disapproval-#{@post_disapproval.id} .created-column a.user-approver", true
|
||||
end
|
||||
|
||||
should "not allow non-mods to see disapprover names" do
|
||||
get post_disapprovals_path
|
||||
assert_response :success
|
||||
assert_select "tr#post-disapproval-#{@post_disapproval.id} .created-column a.user-post-approver", false
|
||||
assert_select "tr#post-disapproval-#{@post_disapproval.id} .created-column a.user-approver", false
|
||||
end
|
||||
|
||||
context "when a non-mod searches by disapprover name" do
|
||||
|
||||
@@ -16,7 +16,7 @@ module Sources
|
||||
end
|
||||
|
||||
should "get the image url" do
|
||||
assert_equal(["https://skeb.imgix.net/uploads/origins/307941e9-dbe0-4e4b-93d4-94accdaff9a0?bg=%23fff&auto=format&w=800&s=e0ddfb1fa0d9f23797b338598aae78fa"], @site.image_urls)
|
||||
assert_equal(["https://skeb.imgix.net/uploads/origins/307941e9-dbe0-4e4b-93d4-94accdaff9a0?bg=%23fff&auto=format&fm=webp&w=800&s=0c4bc4f0e5c231b39a81c2647988caa2"], @site.image_urls)
|
||||
end
|
||||
|
||||
should "get the page url" do
|
||||
@@ -69,7 +69,7 @@ module Sources
|
||||
context "A post with both the small and large version clean" do
|
||||
should "just get the bigger image" do
|
||||
site = Source::Extractor.find("https://skeb.jp/@goma_feet/works/1")
|
||||
assert_equal(["https://skeb.imgix.net/uploads/origins/78ca23dc-a053-4ebe-894f-d5a06e228af8?bg=%23fff&auto=format&w=800&s=3de55b04236059113659f99fd6900d7d"], site.image_urls)
|
||||
assert_equal(["https://skeb.imgix.net/uploads/origins/78ca23dc-a053-4ebe-894f-d5a06e228af8?bg=%23fff&auto=format&fm=webp&w=800&s=3a458a1e443dee3d73d45e88f0794f85"], site.image_urls)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,8 +77,8 @@ module Sources
|
||||
should "get both correctly and in the right order" do
|
||||
site = Source::Extractor.find("https://skeb.jp/@LambOic029/works/146")
|
||||
image_urls = %w[
|
||||
https://skeb.imgix.net/uploads/origins/3fc062c5-231d-400f-921f-22d77cde54df?bg=%23fff&auto=format&txtfont=bold&txtshad=70&txtclr=BFFFFFFF&txtalign=middle%2Ccenter&txtsize=150&txt=SAMPLE&w=800&s=80a1373b3f8e9bf0108d201fba34de71
|
||||
https://skeb.imgix.net/uploads/origins/e888bb27-e1a6-48ec-a317-7615252ff818?bg=%23fff&auto=format&txtfont=bold&txtshad=70&txtclr=BFFFFFFF&txtalign=middle%2Ccenter&txtsize=150&txt=SAMPLE&w=800&s=9df9b46bbfad404d3a65c7c56b0cbf40
|
||||
https://skeb.imgix.net/uploads/origins/3fc062c5-231d-400f-921f-22d77cde54df?bg=%23fff&auto=format&txtfont=bold&txtshad=70&txtclr=BFFFFFFF&txtalign=middle%2Ccenter&txtsize=150&txt=SAMPLE&fm=webp&w=800&s=7dbecbeb7b05394537b60c881a081776
|
||||
https://skeb.imgix.net/uploads/origins/e888bb27-e1a6-48ec-a317-7615252ff818?bg=%23fff&auto=format&txtfont=bold&txtshad=70&txtclr=BFFFFFFF&txtalign=middle%2Ccenter&txtsize=150&txt=SAMPLE&fm=webp&w=800&s=64713510bc4a36b3422dff4b93e4ae87
|
||||
]
|
||||
|
||||
assert_equal(image_urls, site.image_urls)
|
||||
|
||||
Reference in New Issue
Block a user