Sha256: cf29431d595828e5dc85da94b3d02c41b8a21a047cfcbfd4a837db49f4e5395e

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

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.mkdir_p(@config_path)
      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.rm_rf(@config_path)
    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

2 entries across 2 versions & 1 rubygems

Version Path
alchemy_cms-2.2.rc8 spec/page_layout_spec.rb
alchemy_cms-2.2.rc7 spec/page_layout_spec.rb