post replacements: refactor and fix tests.
* Move replacement tests from test/unit/upload_service_test.rb to test/functional/post_replacement_controller_test.rb * Move UploadService::Replacer to PostReplacementProcessor. * Fix a minor bug where if you used the API to replace a post with a file, the replacement would fail unless you passed an empty string for the replacement_url.
This commit is contained in:
@@ -842,13 +842,6 @@ class Post < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def replace!(params)
|
||||
replacement = replacements.create(params)
|
||||
processor = UploadService::Replacer.new(post: self, replacement: replacement)
|
||||
processor.process!
|
||||
replacement
|
||||
end
|
||||
end
|
||||
|
||||
module VersionMethods
|
||||
|
||||
Reference in New Issue
Block a user