Sha256: f21c646896e4869ebbc98e0a979e84916d7b02cf6f58dc22f0dab093f9ba89b6

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

module Alchemy
  describe PageLayout do

    context "method get_layouts" do

      it "should generally return page_layouts, nothing else!" do
        PageLayout.read_layouts_file.should be_instance_of(Array)
      end

    end

    context "with custom page layouts" do

      it "should return the users page_layouts if exists in the application" do
        @config_path = Rails.root.join("config/alchemy")
        FileUtils.mv(File.join(@config_path, 'page_layouts.yml'), File.join(@config_path, 'page_layouts.bak'))
        layouts_file = File.join(@config_path, 'page_layouts.yml')
        File.open(layouts_file, 'w') do |page_layouts|
          page_layouts.puts "- name: testlayout\n  elements:"
        end
        PageLayout.read_layouts_file.first.values.should include("testlayout")
      end

      after(:each) do
        FileUtils.mv(File.join(@config_path, 'page_layouts.bak'), File.join(@config_path, 'page_layouts.yml'))
      end

    end

    it "should not display hidden page layouts" do
      PageLayout.selectable_layouts(Language.get_default).each { |e| e["hide"].should_not == true }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alchemy_cms-2.3.2 spec/models/page_layout_spec.rb
alchemy_cms-2.3.1 spec/models/page_layout_spec.rb
alchemy_cms-2.3.0 spec/models/page_layout_spec.rb
alchemy_cms-2.3.rc5 spec/models/page_layout_spec.rb