Sha256: 010f9d72af17b59af9c260c046f5e4debab0e3041fe2d1c69edb26c90215bf52

Contents?: true

Size: 990 Bytes

Versions: 16

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

describe Qbrick::AssetBrick, type: :model do
  let :asset_brick do
    Qbrick::AssetBrick.new
  end

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

    context 'without a #caption' do
      it 'has an error' do
        expect(asset_brick.errors[:caption].count).to eq(1)
      end
    end
  end

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

  describe '.styles' do
    it 'returns the available link styles' do
      expect(Qbrick::AssetBrick.styles).to eq(%w(pdf word excel button))
    end
  end

  describe '#to_style_class' do
    it 'includes the link style' do
      allow(asset_brick).to receive(:link_style).and_return('pdf')
      expect(asset_brick.to_style_class).to eq('qbrick-asset-brick pdf')
    end
  end

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

Version data entries

16 entries across 16 versions & 1 rubygems

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