spec/view/view_render_spec.rb in garterbelt-0.1.0 vs spec/view/view_render_spec.rb in garterbelt-0.1.1
- old
+ new
@@ -271,9 +271,33 @@
@view.should_not_receive(:_escape=)
@view.non_escape_tag(:pre, "<div>content</div>", {:class => 'classy'})
end
end
+ describe '#compact_tag' do
+ it 'should call #tag' do
+ @view.should_receive(:tag)
+ @view.compact_tag(:textarea, "", {:class => 'classy'})
+ end
+
+ it 'passes in the :render_style option with :minified to tag' do
+ @view.should_receive(:tag).with(:textarea, "", {:render_style => :compact})
+ @view.compact_tag(:textarea, "")
+ end
+
+ it 'passes in the :render_style option with :minified when not receiving content arguments' do
+ @view.should_receive(:tag).with(:textarea, {:render_style => :compact, :class => :foo})
+ @view.compact_tag(:textarea, :class => :foo)
+ end
+
+ it 'content tag should be created with the correct attributes' do
+ @view.compact_tag(:textarea, :class => 'foo')
+ tag = @view._buffer.last
+ tag.style.should == :compact
+ tag.attributes.keys.should_not include :render_style
+ end
+ end
+
describe '#text' do
it 'makes a new Text' do
Garterbelt::Text.should_receive(:new).and_return('some content')
@view.text("content")
end
\ No newline at end of file