require File.dirname(__FILE__) + '/../spec_helper' describe DeprecatedTags do before do @page = Page.new(:slug => "/", :parent_id => nil, :title => 'Home') @keywords = PageField.new(:name => 'Keywords', :content => "Home, Page") @description = PageField.new(:name => 'Description', :content => 'The homepage') @escaped_keywords = PageField.new(:name => 'Keywords', :content => "sweet & harmonious biscuits") @escaped_description = PageField.new(:name => 'Description', :content => 'sweet & harmonious biscuits') end describe "" do it "should render tags for the description and keywords" do @page.fields = [@keywords, @description] @page.should render('').as(%{}) end it "should render tags with escaped values for the description and keywords" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as(%{}) end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the description and keywords" do @page.fields = [@keywords, @description] @page.should render('').as(%{The homepageHome, Page}) end it "should escape the contents of the description and keywords" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as("sweet & harmonious biscuitssweet & harmonious biscuits") end end end describe "" do it "should render a tag for the description" do @page.fields = [@keywords, @description] @page.should render('').as(%{}) end it "should render a tag with escaped value for the description" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as(%{}) end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the description" do @page.fields = [@keywords, @description] @page.should render('').as(%{The homepage}) end it "should escape the contents of the description" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as("sweet & harmonious biscuits") end end end describe "" do it "should render a tag for the keywords" do @page.fields = [@keywords, @description] @page.should render('').as(%{}) end it "should render a tag with escaped value for the keywords" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as(%{}) end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the keywords" do @page.fields = [@keywords, @description] @page.should render('').as(%{Home, Page}) end it "should escape the contents of the keywords" do @page.fields = [@escaped_keywords, @escaped_description] @page.should render('').as("sweet & harmonious biscuits") end end end end