media assets: move more file-handling logic into MediaAsset.
Move more of the file-handling logic from UploadService and StorageManager into MediaAsset. This is part of refactoring posts and uploads to allow multiple images per post.
This commit is contained in:
@@ -12,14 +12,14 @@ class StorageManagerTest < ActiveSupport::TestCase
|
||||
|
||||
context "#store method" do
|
||||
should "store the file" do
|
||||
@storage_manager.store(StringIO.new("data"), "#{@temp_dir}/test.txt")
|
||||
@storage_manager.store(StringIO.new("data"), "test.txt")
|
||||
|
||||
assert("data", File.read("#{@temp_dir}/test.txt"))
|
||||
end
|
||||
|
||||
should "overwrite the file if it already exists" do
|
||||
@storage_manager.store(StringIO.new("foo"), "#{@temp_dir}/test.txt")
|
||||
@storage_manager.store(StringIO.new("bar"), "#{@temp_dir}/test.txt")
|
||||
@storage_manager.store(StringIO.new("foo"), "test.txt")
|
||||
@storage_manager.store(StringIO.new("bar"), "test.txt")
|
||||
|
||||
assert("bar", File.read("#{@temp_dir}/test.txt"))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user