Sha256: 277e2422348c7ac0e010f3e984a0869d867a4ea6ef786dc54ef0e13b5a87cc90

Contents?: true

Size: 1.04 KB

Versions: 42

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Kuhsaft::ImageBrick do

  let :image_brick do
    Kuhsaft::ImageBrick.new
  end

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

    context 'without an #image' do
      it 'has en error' do
        image_brick.should have(1).error_on(:image)
      end
    end
  end

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

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

  describe '#user_can_add_childs?' do
    it 'returns false' do
      image_brick.user_can_add_childs?.should be_false
    end
  end

  describe '#uploader?' do
    it 'returns true' do
      image_brick.uploader?.should be_true
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
kuhsaft-1.2.15 spec/models/image_brick_spec.rb
kuhsaft-1.2.14 spec/models/image_brick_spec.rb