Fix #4377: Save commentary by default.
Remove the "Include artist commentary" checkbox. Commentary is included by default unless the commentary fields are blank.
This commit is contained in:
@@ -1210,10 +1210,9 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
@upload = FactoryBot.create(:source_upload, file_size: 1000, md5: "12345", file_ext: "jpg", image_width: 100, image_height: 100)
|
||||
end
|
||||
|
||||
should "create a commentary record" do
|
||||
assert_difference(-> { ArtistCommentary.count }) do
|
||||
should "create a commentary record if the commentary is present" do
|
||||
assert_difference("ArtistCommentary.count", 1) do
|
||||
@upload.update!(
|
||||
include_artist_commentary: true,
|
||||
artist_commentary_title: "blah",
|
||||
artist_commentary_desc: "blah",
|
||||
translated_commentary_title: "blah",
|
||||
@@ -1223,6 +1222,18 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
should "not create a commentary record if the commentary is blank" do
|
||||
assert_difference("ArtistCommentary.count", 0) do
|
||||
@upload.update!(
|
||||
artist_commentary_title: "",
|
||||
artist_commentary_desc: "",
|
||||
translated_commentary_title: "",
|
||||
translated_commentary_desc: ""
|
||||
)
|
||||
UploadService.new({}).create_post_from_upload(@upload)
|
||||
end
|
||||
end
|
||||
|
||||
should "create a post" do
|
||||
post = subject.new({}).create_post_from_upload(@upload)
|
||||
assert_equal([], post.errors.full_messages)
|
||||
|
||||
Reference in New Issue
Block a user