Sha256: 93f35ef0ab4ae5b68ed87a027091fdc72e856073629caef34af69d6ef049ae96

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

require File.expand_path("../../lib/attachie", __FILE__)

require "attachie/file_driver"
require "attachie/fake_driver"
require "attachie/s3_driver"

class Product
  include Attachie

  attr_accessor :id

  def initialize(attributes = {})
    attributes.each do |key, value|
      self.send("#{key}=", value)
    end
  end

  attachment :image, host: ":subdomain.example.com", path_prefix: ":bucket", bucket: "images", driver: Attachie::FileDriver.new("/tmp/attachie"), versions: {
    thumbnail: { path: "products/:id/thumbnail.jpg" },
    original: { path: "products/:id/original.jpg" }
  }

  def subdomain
    "images"
  end
end

RSpec::Matchers.define :be_url do |expected|
  match do |actual|
    URI.parse(actual) rescue false
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
attachie-1.1.2 spec/spec_helper.rb
attachie-1.1.1 spec/spec_helper.rb
attachie-1.1.0 spec/spec_helper.rb
attachie-1.0.1 spec/spec_helper.rb
attachie-1.0.0 spec/spec_helper.rb
attachie-0.0.1 spec/spec_helper.rb