Sha256: fb18325585010e6450f8cdd2d1575f1898a71c20304b4e3d45fae7be6155311a

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Alchemy::PageLayout do

  context "method get_layouts" do

    it "should generally return page_layouts, nothing else!" do
      Alchemy::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
      Alchemy::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
    Alchemy::PageLayout.selectable_layouts(FactoryGirl.create(:language)).each { |e| e["hide"].should_not == true }
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alchemy_cms-2.2.4 spec/page_layout_spec.rb
alchemy_cms-2.2.3.2 spec/page_layout_spec.rb
alchemy_cms-2.2.3.1 spec/page_layout_spec.rb
alchemy_cms-2.2.2 spec/page_layout_spec.rb
alchemy_cms-2.2.1 spec/page_layout_spec.rb
alchemy_cms-2.2.0 spec/page_layout_spec.rb
alchemy_cms-2.2.rc15 spec/page_layout_spec.rb
alchemy_cms-2.2.rc14 spec/page_layout_spec.rb
alchemy_cms-2.2.rc13 spec/page_layout_spec.rb
alchemy_cms-2.2.rc11 spec/page_layout_spec.rb