Sha256: eebde580f0c64650cc92411e9321ea9d50e771e4b7fb8281ca20aacc4d630235

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kuhsaft-1.1.1 spec/models/placeholder_brick_spec.rb
kuhsaft-1.1.0 spec/models/placeholder_brick_spec.rb
kuhsaft-1.0.3 spec/models/placeholder_brick_spec.rb
kuhsaft-1.0.2 spec/models/placeholder_brick_spec.rb
kuhsaft-1.0.1 spec/models/placeholder_brick_spec.rb
kuhsaft-1.0.0 spec/models/placeholder_brick_spec.rb