Sha256: 2cd9110d9331e35c17f2f965050801bdb0c4476a2ef1547e7c2563a9dd63cca8

Contents?: true

Size: 855 Bytes

Versions: 2

Compression:

Stored size: 855 Bytes

Contents

require 'spec_helper'

describe CarrierWave::Meta::ActiveRecord do
  let(:model) { TestComposedModel.new }
  let(:model_with_image) do
    model.tap do |m|
      m.image = File.open('spec/fixtures/big.jpg')
      m.save!
    end
  end

  it "model's virtual meta attributes must exists" do
    subject::ALLOWED.each do |name|
      model.should respond_to(:"image_#{name}")
    end
  end

  it "must assign model's virtual attributes and save meta column" do
    subject::ALLOWED.each do |name|
      model_with_image.send(:"image_#{name}").should_not be_blank
    end

    model_with_image.image_version_width.should_not be_blank
    model_with_image.image_version_height.should_not be_blank

    model_with_image.reload

    model_with_image.image_version_width.should_not be_blank
    model_with_image.image_version_height.should_not be_blank
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carrierwave-meta-0.0.7 spec/modules/active_record_spec.rb
carrierwave-meta-0.0.5 spec/modules/active_record_spec.rb