Sha256: 68666952bb30a91ad6ddccd87c74e6b8f7b2975ee4e06563af3c164a527a4991

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Qbrick::ImageBrick, type: :model do
  let :image_brick do
    Qbrick::ImageBrick.new
  end

  describe '#valid' do
    before do
      image_brick.valid?
    end

    context 'without an #image' do
      it 'has en error' do
        expect(image_brick.errors[:image].size).to eq(1)
      end
    end
  end

  describe '#save' do
    context 'when changing the image size' do
      it 'regenerates the image version' do
        allow(image_brick).to receive(:image_size_changed?).and_return(true)
        allow(image_brick).to receive(:image_present?).and_return(true)
        expect(image_brick.image).to receive(:recreate_versions!)
        image_brick.resize_image_if_size_changed
      end
    end
  end

  describe '#bricks' do
    it 'can not have childs' do
      expect(image_brick).not_to respond_to(:bricks)
    end
  end

  describe '#user_can_add_childs?' do
    it 'returns false' do
      expect(image_brick.user_can_add_childs?).to be_falsey
    end
  end

  describe '#uploader?' do
    it 'returns true' do
      expect(image_brick.uploader?).to be_truthy
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 spec/models/image_brick_spec.rb
qbrick-2.7 spec/models/image_brick_spec.rb
qbrick-2.6.10 spec/models/image_brick_spec.rb
qbrick-2.6.9 spec/models/image_brick_spec.rb
qbrick-2.6.8 spec/models/image_brick_spec.rb
qbrick-2.6.7 spec/models/image_brick_spec.rb
qbrick-2.6.6 spec/models/image_brick_spec.rb
qbrick-2.6.5 spec/models/image_brick_spec.rb
qbrick-2.6.4 spec/models/image_brick_spec.rb
qbrick-2.6.3 spec/models/image_brick_spec.rb
qbrick-2.6.2 spec/models/image_brick_spec.rb
qbrick-2.6.1 spec/models/image_brick_spec.rb
qbrick-2.6.0 spec/models/image_brick_spec.rb
qbrick-2.5.2 spec/models/image_brick_spec.rb
qbrick-2.5.1 spec/models/image_brick_spec.rb
qbrick-2.5.0 spec/models/image_brick_spec.rb