Sha256: 3ce24d08160b3622ec3555b11c758029c3424c6dd64d7f54e729545e8a9193af
Contents?: true
Size: 1.37 KB
Versions: 16
Compression:
Stored size: 1.37 KB
Contents
require 'spec_helper' require 'fileutils' describe Qbrick::PlaceholderBrick, type: :model do let :placeholder_brick do Qbrick::PlaceholderBrick.new end before do FileUtils.mkdir_p("#{Rails.root}/app/views/qbrick/placeholder_bricks/partials") FileUtils.touch("#{Rails.root}/app/views/qbrick/placeholder_bricks/partials/_valid_partial.html.haml") FileUtils.touch("#{Rails.root}/app/views/qbrick/placeholder_bricks/partials/not_a_partial.html.haml") FileUtils.touch("#{Rails.root}/app/views/qbrick/placeholder_bricks/partials/_not_a_haml_file.txt") end after do FileUtils.rm_rf(Dir.glob("#{Rails.root}/app/views/qbrick")) end describe 'available partials' do it 'returns haml files' do expect(Qbrick::PlaceholderBrick.available_partials.flatten).to include('valid_partial') end it 'returns only partials' do expect(Qbrick::PlaceholderBrick.available_partials.flatten).not_to include('not_a_partial') end it 'does not return other files' do expect(Qbrick::PlaceholderBrick.available_partials.flatten).not_to include('not_a_haml_file') end end describe '#bricks' do it 'can not have childs' do expect(placeholder_brick).not_to respond_to(:bricks) end end describe '#user_can_add_childs?' do it 'returns false' do expect(placeholder_brick.user_can_add_childs?).to be_falsey end end end
Version data entries
16 entries across 16 versions & 1 rubygems