Files
openfoodnetwork/spec/services/image_importer_spec.rb
Prikesh Savla 631306cfb3 Extended imageImport and ImageBuilder to get the content type of the file for the attacment for avoiding issues for files without extensions.
Updated config/locale/en.yml for the active_storage_validations related error messages
2025-12-09 08:06:29 +05:30

22 lines
559 B
Ruby

# frozen_string_literal: false
require 'spec_helper'
RSpec.describe ImageImporter do
let(:ofn_url) { "https://s3.amazonaws.com/ofn_production/eofop2en1y6tu9fr1x9b0wzwgs5r" }
let(:product) { create(:product) }
describe "#import" do
it "downloads from the Internet", :vcr, :aggregate_failures do
expect {
subject.import(ofn_url, product)
}.to change {
Spree::Image.count
}.by(1)
expect(product.image).not_to be_nil
expect(product.reload.image.attachment_blob.byte_size).to eq 12_926
end
end
end