# require 'rails_helper' # # describe "Page rendering snippets" do # dataset :pages, :snippets # # test_helper :render # # let(:page){ pages(:home) } # # it 'should render a snippet' do # page.render_snippet(snippets(:first)).should == 'test' # end # # it 'should render a snippet with a filter' do # page.render_snippet(snippets(:markdown)).should include(%{**markdown** for Snippets!}) # end # # it 'should render a snippet with a tag' do # page.render_snippet(snippets(:radius)).should == 'Home' # end # # describe "" do # it "should render the contents of the specified snippet" do # page.should render('').as('test') # end # # it "should render an error when the snippet does not exist" do # page.should render('').with_error("snippet not found: non-existent") # end # # it "should render an error when not given a 'name' attribute" do # page.should render('').with_error("`snippet' tag must contain `name' attribute") # end # # it "should filter the snippet with its assigned filter" do # page.should render('').matching(Regexp.new(Regexp.quote('**markdown** for Snippets!'))) # end # # it "should maintain the global page inside the snippet" do # parent_page = pages(:parent) # parent_page.should render('').as("#{parent_page.title} " * parent_page.children.count) # end # # it "should maintain the global page when the snippet renders recursively" do # pages(:child).should render('').as("Great GrandchildGrandchildChild") # end # # it "should render the specified snippet when called as an empty double-tag" do # page.should render('').as('test') # end # # it "should capture contents of a double tag, substituting for in snippet" do # page.should render('inner'). # as('Before...inner...and after') # end # # it "should do nothing with contents of double tag when snippet doesn't yield" do # page.should render('content disappears!'). # as('test') # end # # it "should render nested yielding snippets" do # page.should render('Hello, World!'). # as('
Before...Hello, World!...and after
') # end # # it "should render double-tag snippets called from within a snippet" do # page.should render('the content'). # as('above the content below') # end # # it "should render contents each time yield is called" do # page.should render('French'). # as('French is Frencher than French') # end # end # # it "should do nothing when called from page body" do # page.should render('').as("") # end # end