Sha256: 5bc7ce0b3456f528942bae72c01a462b055473bc584256bb37f8e67028e70dd7
Contents?: true
Size: 1.61 KB
Versions: 9
Compression:
Stored size: 1.61 KB
Contents
require File.expand_path("../../spec_helper", __FILE__) RSpec.describe Attachie::Attachment::Version do it "should interpolate the host, path_prefix and path" do expect(Product.new(id: 1).image(:thumbnail).url).to eq("http://images.example.com/images/products/1/thumbnail.jpg") end it "should know the path without prefix" do expect(Product.new(id: 1).image(:thumbnail).path_without_prefix).to eq("products/1/thumbnail.jpg") end it "should know the bucket" do expect(Product.new(id: 1).image(:thumbnail).bucket).to eq("images") end it "should store a blob" do product = Product.new(id: 1) begin product.image(:thumbnail).store("blob") expect(product.image(:thumbnail).exists?).to be(true) expect(product.image(:thumbnail).value).to eq("blob") ensure product.image(:thumbnail).delete end end it "should support multipart uploads" do product = Product.new(id: 1) begin product.image(:thumbnail).store_multipart do |upload| upload.upload_part("chunk1") upload.upload_part("chunk2") end expect(product.image(:thumbnail).exists?).to be(true) expect(product.image(:thumbnail).value).to eq("chunk1chunk2") ensure product.image(:thumbnail).delete end end it "should delete a blob" do product = Product.new(id: 1) begin product.image(:thumbnail).store("blob") expect(product.image(:thumbnail).exists?).to be(true) product.image(:thumbnail).delete expect(product.image(:thumbnail).exists?).to be(false) ensure product.image(:thumbnail).delete end end end
Version data entries
9 entries across 9 versions & 1 rubygems