Sha256: fb5f6eee6665a36b0e209b8bda2ba6262f81624d78de65b86b667351dafc5c40

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
mango-0.8.0 spec/lib/content_page_spec.rb
mango-0.7.1 spec/lib/content_page_spec.rb
mango-0.7.0 spec/lib/content_page_spec.rb