Sha256: d69b2bc269bcdd1c1ee299d045e236a9c749fdccb648a0d85d48684eb7d0e539
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require "spec_helper" RSpec.describe Carrierwave::Base64::Base64StringIO do context "correct image data" do let(:image_data) { "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABKdhH//2Q==" } subject { described_class.new image_data } it "determines the image format from the Dara URI scheme" do expect(subject.file_format).to eql("jpg") end it "should respond to :original_filename" do expect(subject.original_filename).to eql("file.jpg") end end context "correct pdf data" do let(:image_data) { "data:application/pdf;base64,/9j/4AAQSkZJRgABAQEASABKdhH//2Q==" } subject { described_class.new image_data } it "determines the image format from the Dara URI scheme" do expect(subject.file_format).to eql("pdf") end it "should respond to :original_filename" do expect(subject.original_filename).to eql("file.pdf") end end context "incorrect image data" do it "raises an ArgumentError if Data URI scheme format is missing" do expect do described_class.new("/9j/4AAQSkZJRgABAQEASABIAADKdhH//2Q==") end.to raise_error(Carrierwave::Base64::Base64StringIO::ArgumentError) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
carrierwave-base64-1.5 | spec/base64_string_io_spec.rb |
carrierwave-base64-1.4 | spec/base64_string_io_spec.rb |