spec/models/page_context_spec.rb in radiant-1.0.0.rc2 vs spec/models/page_context_spec.rb in radiant-1.0.0.rc3
- old
+ new
@@ -5,10 +5,11 @@
before :each do
@page = pages(:radius)
@context = PageContext.new(@page)
@parser = Radius::Parser.new(@context, :tag_prefix => 'r')
+ @context = @parser.context
end
it 'should raise an error when it encounters a missing tag' do
lambda { @parser.parse('<r:missing />') }.should raise_error(StandardTags::TagError)
end
@@ -47,20 +48,22 @@
dataset :pages
before :each do
@page = pages(:radius)
@context = PageContext.new(@page)
- @context.stub!(:raise_errors?).and_return(false)
@parser = Radius::Parser.new(@context, :tag_prefix => 'r')
+ @parser.context.stub!(:raise_errors?).and_return(false)
+ @context = @parser.context
end
it 'should output an error when it encounters a missing tag' do
@parser.parse('<r:missing />').should include("undefined tag `missing'")
end
it 'should pop the stack when an error occurs' do
+
@context.current_nesting.should be_empty
- @context.define_tag("error") { |tag| raise "Broken!" }
+ @parser.context.define_tag("error") { |tag| raise "Broken!" }
@parser.parse("<r:error/>").should match(/Broken\!/)
@context.current_nesting.should be_empty
end
end