Sha256: 4919574493a9f59a1ff0160e33d5b246d9a41afa0d6e712a508a9d3233ef62f7

Contents?: true

Size: 1.35 KB

Versions: 56

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'
require 'fileutils'

describe Kuhsaft::PlaceholderBrick do

  let :placeholder_brick do
    Kuhsaft::PlaceholderBrick.new
  end

  before do
    FileUtils.mkdir_p("#{Rails.root}/app/views/kuhsaft/placeholder_bricks/partials")
    FileUtils.touch("#{Rails.root}/app/views/kuhsaft/placeholder_bricks/partials/_valid_partial.html.haml")
    FileUtils.touch("#{Rails.root}/app/views/kuhsaft/placeholder_bricks/partials/not_a_partial.html.haml")
    FileUtils.touch("#{Rails.root}/app/views/kuhsaft/placeholder_bricks/partials/_not_a_haml_file.txt")
  end

  after do
    FileUtils.rm_rf(Dir.glob("#{Rails.root}/app/views/kuhsaft"))
  end

  describe 'available partials' do
    it 'returns haml files' do
      Kuhsaft::PlaceholderBrick.available_partials.flatten.should include('valid_partial')
    end

    it 'returns only partials' do
      Kuhsaft::PlaceholderBrick.available_partials.flatten.should_not include('not_a_partial')
    end

    it 'does not return other files' do
      Kuhsaft::PlaceholderBrick.available_partials.flatten.should_not include('not_a_haml_file')
    end
  end

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

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

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
kuhsaft-1.2.15 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.14 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.13 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.12 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.11 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.10 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.9 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.8 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.7 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.6 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.5 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.4 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.3 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.2 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.1 spec/models/placeholder_brick_spec.rb
kuhsaft-1.2.0 spec/models/placeholder_brick_spec.rb