Sha256: 016763dedd3dbd3e8583899626d02c333b14b34c1360eacfa287beb3dad6ea0a

Contents?: true

Size: 763 Bytes

Versions: 3

Compression:

Stored size: 763 Bytes

Contents

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

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

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

3 entries across 3 versions & 1 rubygems

Version Path
attachie-2.0.0 spec/spec_helper.rb
attachie-1.2.1 spec/spec_helper.rb
attachie-1.2.0 spec/spec_helper.rb