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] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end it "should render tags with escaped values for the description and keywords" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the description and keywords" do @page.fields = [@keywords, @description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{The homepageHome, Page}) end end it "should escape the contents of the description and keywords" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as("sweet & harmonious biscuitssweet & harmonious biscuits") end end end end describe "" do it "should render a tag for the description" do @page.fields = [@keywords, @description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end it "should render a tag with escaped value for the description" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the description" do @page.fields = [@keywords, @description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{The homepage}) end end it "should escape the contents of the description" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as("sweet & harmonious biscuits") end end end end describe "" do it "should render a tag for the keywords" do @page.fields = [@keywords, @description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end it "should render a tag with escaped value for the keywords" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{}) end end describe "with 'tag' attribute set to 'false'" do it "should render the contents of the keywords" do @page.fields = [@keywords, @description] ::ActiveSupport::Deprecation.silence do @page.should render('').as(%{Home, Page}) end end it "should escape the contents of the keywords" do @page.fields = [@escaped_keywords, @escaped_description] ::ActiveSupport::Deprecation.silence do @page.should render('').as("sweet & harmonious biscuits") end end end end describe "" do it "should render with deprecated url attribute" do ::ActiveSupport::Deprecation.silence do lambda { @page.should render(%{
  • }).as(%{
  • test
  • }) }.should_not raise_error end end end end