post replacements: allow replacing with an uploaded file.

This commit is contained in:
evazion
2017-06-22 15:49:27 -05:00
parent c27668d2ef
commit d3e8937716
4 changed files with 16 additions and 4 deletions

View File

@@ -191,6 +191,18 @@ class PostReplacementTest < ActiveSupport::TestCase
end
end
context "a post with an uploaded file" do
should "work" do
Tempfile.open do |file|
file.write(File.read("#{Rails.root}/test/files/test.png"))
file.seek(0)
@post.replace!(replacement_file: file, replacement_url: "")
assert_equal(@post.md5, Digest::MD5.file(file).hexdigest)
end
end
end
context "a post when given a final_source" do
should "change the source to the final_source" do
replacement_url = "http://data.tumblr.com/afed9f5b3c33c39dc8c967e262955de2/tumblr_orwwptNBCE1wsfqepo1_raw.png"