Sha256: ea3ebdb2180706dc9e6d97be119588533dc185598d82a9e5a5886c62f9093af7

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

# TODO: test case for modifying a file updates or clobbers the proper attributes

require 'spec_helper'

module Landable
  describe Layout do
    it "creates themes" do
      Theme.destroy_all
      expect { described_class.all.each(&:to_theme) }.to change { Theme.count }.by(3)
    end

    it "defaults attributes" do
      theme = Theme.where(file: "application").first
      theme.attributes.should include({
        name:        'Application',
        file:        'application',
        extension:   'erb',
        editable:    false,
        description: 'Defined in application.html.erb'
      }.stringify_keys)

      theme.body.should == File.read(Rails.root.join('app/views/layouts/application.html.erb'))
    end

    context 'File Finding' do
      it 'will find the correct application files' do
        Layout.files.any? { |f| f.end_with?('application.haml') }.should be_true
        Layout.files.any? { |f| f.end_with?('application.html.erb') }.should be_true
        Layout.files.any? { |f| f.end_with?('priority.html.erb') }.should be_true
        Layout.files.any? { |f| f.end_with?('_partial.html.haml') }.should be_false
        Layout.files.any? { |f| f.end_with?('partial.html.haml') }.should be_false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
landable-1.13.1 spec/lib/landable/layout_spec.rb
landable-1.12.3 spec/lib/landable/layout_spec.rb
landable-1.12.2 spec/lib/landable/layout_spec.rb
landable-1.12.1 spec/lib/landable/layout_spec.rb
landable-1.11.1 spec/lib/landable/layout_spec.rb
landable-1.11.0 spec/lib/landable/layout_spec.rb