spec/view/view_basics_spec.rb in garterbelt-0.0.9 vs spec/view/view_basics_spec.rb in garterbelt-0.1.0

- old
+ new

@@ -13,106 +13,106 @@ @view = BasicView.new end describe 'attributes' do it 'has a tag buffer' do - @view.buffer.should == [] + @view._buffer.should == [] @tag = Garterbelt::ContentTag.new(:view => @view, :type => :hr) - @view.buffer << @tag - @view.buffer.should == [@tag] + @view._buffer << @tag + @view._buffer.should == [@tag] end describe 'output' do it 'has an output' do @view.output.should == "" end - it 'its output is that of the curator if the curator is not self' do - BasicView.new(:curator => @view).output.should === @view.output + it 'its output is that of the _curator if the _curator is not self' do + BasicView.new(:_curator => @view).output.should === @view.output end end - describe 'escape' do - it 'has escape set to true by default' do - @view.escape.should == true + describe '_escape' do + it 'has _escape set to true by default' do + @view._escape.should == true end it 'can be set' do - @view.escape = false - @view.escape.should == false - BasicView.new(:escape => false).escape.should == false + @view._escape = false + @view._escape.should == false + BasicView.new(:_escape => false)._escape.should == false end end - describe 'level' do + describe '_level' do it 'is 0 by default' do - @view.level.should == 0 + @view._level.should == 0 end it 'can be set via initialization' do - BasicView.new(:level => 42).level.should == 42 + BasicView.new(:_level => 42)._level.should == 42 end end it 'can be initailzed with a block' do view = BasicView.new do Garterbelt::Tag.new(:type => :p, :content => 'Initalization block content', :view => view) end view.block.is_a?(Proc).should be_true end - it 'saves the options' do + it 'saves the initialization options' do view = BasicView.new(:foo => 'foo', :bar => 'bar') - view.options.should == {:foo => 'foo', :bar => 'bar'} + view.initialization_options.should == {:foo => 'foo', :bar => 'bar'} end it 'render_style defaults to :pretty' do view = BasicView.new view.render_style.should == :pretty end - describe 'setting the curator: view responsible for displaying the rendered content' do + describe 'setting the _curator: view responsible for displaying the rendered content' do before do - @view.level = 42 + @view._level = 42 @view.output = "foo" - @view.buffer = ["bar"] - @view.escape = false + @view._buffer = ["bar"] + @view._escape = false @view.render_style = :text - @child = BasicView.new(:curator => @view) + @child = BasicView.new(:_curator => @view) end it 'is self by default' do - @view.curator.should == @view + @view._curator.should == @view end it 'can be set' do - @view.curator = BasicView.new - @view.curator.should_not == @view + @view._curator = BasicView.new + @view._curator.should_not == @view end it 'can be intialized in' do - BasicView.new(:curator => @view).curator.should == @view + BasicView.new(:_curator => @view)._curator.should == @view end describe 'resets other attributes' do - it 'sets the output to the curator\'s' do + it 'sets the output to the _curator\'s' do @child.output.should === @view.output end - it 'sets the level to the curator\'s' do - @child.level.should == @view.level - @child.level.should == 42 + it 'sets the _level to the _curator\'s' do + @child._level.should == @view._level + @child._level.should == 42 end - it 'sets the buffer to the curator\'s' do - @child.buffer.should === @view.buffer + it 'sets the buffer to the _curator\'s' do + @child._buffer.should === @view._buffer end - it 'sets the escape to the curator\'s' do - @child.escape.should == @view.escape + it 'sets the _escape to the _curator\'s' do + @child._escape.should == @view._escape end - it 'sets the render_style to the curator\'s' do + it 'sets the render_style to the _curator\'s' do @child.render_style.should == @view.render_style end end end