Sha256: 5ef014d8dc4288582ccde4f496585e7022b4b3485d1e46328434f6dcd691ee69

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

# encoding: UTF-8
require "spec_helper"

describe Mango::ContentPage do
  describe "constants" do
    it "defines TEMPLATE_ENGINES" do
      Mango::ContentPage::TEMPLATE_ENGINES.should == {
        Tilt::BlueClothTemplate => :markdown,
        Tilt::HamlTemplate      => :haml,
        Tilt::ERBTemplate       => :erb,
        Tilt::LiquidTemplate    => :liquid
      }
    end

    it "defines DEFAULT_ATTRIBUTES" do
      Mango::ContentPage::DEFAULT_ATTRIBUTES.should == {
        "engine" => Mango::ContentPage::TEMPLATE_ENGINES.key(:markdown),
        "view"   => "page.haml"
      }
    end
  end

  #################################################################################################

  describe "attribute syntactic sugar" do
    before(:all) do
      data = <<-EOS
---
title: Syntactic Sugar Makes Life Sweeter
view: template.haml
---
EOS
      @page = Mango::ContentPage.new(:data => data)
    end

    it "sweetens the title attribute" do
      @page.title.should == @page.attributes["title"]
    end

    it "sweetens the view attribute" do
      @page.view.should == "template.haml"
    end

    it "doesn't sweeten an unknown attribute" do
      lambda { @page.unknown }.should raise_exception(NoMethodError)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mango-0.6.3 spec/lib/content_page_spec.rb
mango-0.6.2 spec/lib/content_page_spec.rb
mango-0.6.1 spec/lib/content_page_spec.rb
mango-0.6.0 spec/lib/content_page_spec.rb