spec/view/view_render_spec.rb in garterbelt-0.0.4 vs spec/view/view_render_spec.rb in garterbelt-0.0.5
- old
+ new
@@ -56,23 +56,10 @@
@img.should_receive(:render)
@view.render_buffer
end
- it 'should recycle the tags' do
- @view.buffer << @hr << @input << @img
- @hr.stub(:render)
- @input.stub(:render)
- @img.stub(:render)
-
- @hr.should_receive(:recycle)
- @input.should_receive(:recycle)
- @img.should_receive(:recycle)
-
- @view.render_buffer
- end
-
it 'will add non renderable items to the output as strings' do
@view.buffer << "foo " << :bar
@view.render_buffer
@view.output.should include 'foo bar'
end
@@ -141,11 +128,10 @@
end
describe 'class method' do
before do
@rendered = @view.render
- @view.stub(:recycle)
end
it 'makes a new view' do
BasicView.should_receive(:new).and_return(@view)
BasicView.render
@@ -161,24 +147,27 @@
BasicView.stub(:new).and_return(@view)
@view.should_receive(:render).with(:alt_content)
BasicView.render :method => :alt_content
end
- it 'recycles the view' do
- BasicView.stub(:new).and_return(@view)
- @view.should_receive(:recycle)
- BasicView.render
- end
-
it 'returns the output' do
BasicView.stub(:new).and_return(@view)
BasicView.render.should == @rendered
end
end
+
+ describe 'block initalized content' do
+ it 'has a #render_block method that renders that content' do
+ @view = BasicView.new do
+ @view.buffer << Garterbelt::ContentTag.new(:type => :p, :view => @view, :content => 'Block level p tag')
+ end
+ @view.render_block.should include "Block level p tag"
+ end
+ end
end
- describe 'tag helpers' do
+ describe 'renderers' do
describe '#tag' do
it 'makes a new tag' do
Garterbelt::ContentTag.should_receive(:new).with(
:type => :p, :view => @view, :content => 'content', :attributes => {:class => 'classy'}
).and_return('content')
@@ -328,14 +317,14 @@
end
end
describe 'comment' do
it 'makes a comment object' do
- @view.comment('This is a comment.').is_a?(Garterbelt::Comment).should be_true
+ @view.comment_tag('This is a comment.').is_a?(Garterbelt::Comment).should be_true
end
it 'puts it on the buffer' do
- comment = @view.comment("new comment now")
+ comment = @view.comment_tag("new comment now")
@view.buffer.last.should == comment
end
end
describe 'doctype' do
\ No newline at end of file