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-2.1.1 spec/models/placeholder_brick_spec.rb
kuhsaft-2.1.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.8.6 spec/models/placeholder_brick_spec.rb
kuhsaft-1.8.5 spec/models/placeholder_brick_spec.rb
kuhsaft-2.0.3 spec/models/placeholder_brick_spec.rb
kuhsaft-2.0.2 spec/models/placeholder_brick_spec.rb
kuhsaft-1.8.4 spec/models/placeholder_brick_spec.rb
kuhsaft-1.8.1 spec/models/placeholder_brick_spec.rb
kuhsaft-2.0.1 spec/models/placeholder_brick_spec.rb
kuhsaft-2.0.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.8.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.7.1 spec/models/placeholder_brick_spec.rb
kuhsaft-1.7.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.6.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.5.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.4.3 spec/models/placeholder_brick_spec.rb
kuhsaft-1.4.2 spec/models/placeholder_brick_spec.rb
kuhsaft-1.4.1 spec/models/placeholder_brick_spec.rb
kuhsaft-1.4.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.3.1 spec/models/placeholder_brick_spec.rb