parent
b0600e52b6
commit
af15ba86a0
|
@ -56,18 +56,17 @@ RSpec.describe "Post rake tasks" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'missing_uploads' do
|
describe 'missing_uploads' do
|
||||||
let(:upload) { Fabricate(:upload) }
|
let(:url) { "/uploads/#{RailsMultisite::ConnectionManagement.current_db}/original/1X/d1c2d40ab994e8410c.png" }
|
||||||
let(:optimized) { Fabricate(:optimized_image, url: '/uploads/default/optimized/1X/d1c2d40ab994e8410c_100x200.png') }
|
let(:upload) { Fabricate(:upload, url: url) }
|
||||||
|
|
||||||
it 'should create post custom field for missing upload' do
|
it 'should create post custom field for missing upload' do
|
||||||
Fabricate(:post, cooked: "A sample post <img src='#{upload.url}'>")
|
post = Fabricate(:post, raw: "A sample post <img src='#{url}'>")
|
||||||
upload.destroy!
|
upload.destroy!
|
||||||
|
|
||||||
Rake::Task['posts:missing_uploads'].invoke
|
Rake::Task['posts:missing_uploads'].invoke
|
||||||
|
|
||||||
field = PostCustomField.find_by(name: "missing_uploads")
|
post.reload
|
||||||
expect(field).to be_present
|
expect(post.custom_fields[Post::MISSING_UPLOADS]).to eq([url])
|
||||||
expect(field.value).to eq(upload.url)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue