refactor(watermark): small text based watermarked to increase document visibility
This commit is contained in:
parent
2f5310a470
commit
201b31bf36
7 changed files with 172 additions and 66 deletions
23
spec/services/watermark_service_spec.rb
Normal file
23
spec/services/watermark_service_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
RSpec.describe WatermarkService do
|
||||
let(:image) { file_fixture("logo_test_procedure.png") }
|
||||
let(:watermark_service) { WatermarkService.new }
|
||||
|
||||
describe '#process' do
|
||||
it 'returns a tempfile if watermarking succeeds' do
|
||||
Tempfile.create do |output|
|
||||
watermark_service.process(image, output)
|
||||
# output size should always be a little greater than input size
|
||||
expect(output.size).to be_between(image.size, image.size * 1.5)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns nil if metadata is blank' do
|
||||
allow(watermark_service).to receive(:image_metadata).and_return(nil)
|
||||
|
||||
Tempfile.create do |output|
|
||||
expect(watermark_service.process(image.to_path, output)).to be_nil
|
||||
expect(output.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue