Sha256: e2cf6beba968edebb05c67811d8d4f5ed55f63c70269456069dc0d9447d6ce0a

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

class TestDelegateUploader < CarrierWave::Uploader::Base
  VALUES = {
    :x => 5,
    :version_x => 10,
    :dimensions => [1, 1],
    :version_dimensions => [2, 2]
  }

  DEFAULT_VALUES = {
    :x => 0,
    :dimensions => []
  }

  def store_dir
    "tmp/store"
  end

  def cache_dir
    "tmp/cache"
  end

  include CarrierWave::ModelDelegateAttribute

  model_delegate_attribute :x, DEFAULT_VALUES[:x]
  model_delegate_attribute :dimensions, DEFAULT_VALUES[:dimensions]

  process :set_values
  version :version do
    process :set_values_for_version
  end

  def set_values
    self.x = VALUES[:x]
    self.dimensions = VALUES[:dimensions]
  end

  def set_values_for_version
    self.x = VALUES[:version_x]
    self.dimensions = VALUES[:version_dimensions]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carrierwave-meta-0.0.7 spec/support/test_delegate_uploader.rb
carrierwave-meta-0.0.5 spec/support/test_delegate_uploader.rb