update tests

This commit is contained in:
Albert Yi
2018-06-09 13:38:06 -07:00
parent 0e6c358701
commit b0c2ddba8b
11 changed files with 378 additions and 323 deletions

View File

@@ -28,8 +28,7 @@ class PostTest < ActiveSupport::TestCase
context "Deletion:" do
context "Expunging a post" do
setup do
@upload = FactoryBot.create(:jpg_upload)
@upload.process!
@upload = UploadService.new(FactoryBot.attributes_for(:jpg_upload)).start!
@post = @upload.post
Favorite.add(post: @post, user: @user)
end
@@ -2677,4 +2676,19 @@ class PostTest < ActiveSupport::TestCase
end
end
end
context "#replace!" do
subject { @post.replace!(tags: "something", replacement_url: "https://danbooru.donmai.us/data/preview/download.png") }
setup do
@post = FactoryBot.create(:post)
@post.stubs(:queue_delete_files)
end
should "update the post" do
assert_changes(-> { @post.md5 }) do
subject
end
end
end
end