spec/lib/content_page_spec.rb in mango-0.5.4 vs spec/lib/content_page_spec.rb in mango-0.6.0

- old
+ new

@@ -1,44 +1,48 @@ # encoding: UTF-8 require "spec_helper" describe Mango::ContentPage do - - ################################################################################################# - - describe "class constants" do - it "defines CONTENT_ENGINES" do - Mango::ContentPage::CONTENT_ENGINES.should have(2).item - Mango::ContentPage::CONTENT_ENGINES.should include(:haml => ["haml"]) - Mango::ContentPage::CONTENT_ENGINES.should include(:markdown => ["md", "mdown", "markdown"]) + 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" do - Mango::ContentPage::DEFAULT.should have(3).items - Mango::ContentPage::DEFAULT.should include(:body => "") - Mango::ContentPage::DEFAULT.should include(:content_engine => :markdown) - - attributes = Mango::ContentPage::DEFAULT[:attributes] - attributes.should include("view" => :page) + 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 - @page = Mango::ContentPage.new <<-EOS + data = <<-EOS --- title: Syntactic Sugar Makes Life Sweeter +view: template.haml --- EOS + @page = Mango::ContentPage.new(:data => data) end - it "makes the title sweeter" do + it "sweetens the title attribute" do @page.title.should == @page.attributes["title"] end - it "doesn't make unknown sweeter" do + + 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