inversion 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +157 -28
  3. data/History.rdoc +8 -0
  4. data/Manifest.txt +2 -3
  5. data/Rakefile +1 -3
  6. data/lib/inversion.rb +2 -2
  7. data/lib/inversion/exceptions.rb +1 -1
  8. data/lib/inversion/{template/parser.rb → parser.rb} +5 -5
  9. data/lib/inversion/renderstate.rb +55 -5
  10. data/lib/inversion/template.rb +5 -3
  11. data/lib/inversion/template/attrtag.rb +19 -12
  12. data/lib/inversion/template/begintag.rb +1 -2
  13. data/lib/inversion/template/configtag.rb +7 -1
  14. data/lib/inversion/template/containertag.rb +8 -3
  15. data/lib/inversion/template/elsetag.rb +16 -0
  16. data/lib/inversion/template/elsiftag.rb +16 -0
  17. data/lib/inversion/template/escapetag.rb +1 -1
  18. data/lib/inversion/template/fortag.rb +2 -5
  19. data/lib/inversion/template/iftag.rb +17 -35
  20. data/lib/inversion/template/importtag.rb +2 -1
  21. data/lib/inversion/template/includetag.rb +2 -0
  22. data/lib/inversion/template/node.rb +1 -1
  23. data/lib/inversion/template/tag.rb +5 -2
  24. data/lib/inversion/template/textnode.rb +1 -2
  25. data/lib/inversion/template/unlesstag.rb +16 -26
  26. data/lib/inversion/template/yieldtag.rb +3 -8
  27. data/spec/inversion/{template/parser_spec.rb → parser_spec.rb} +14 -14
  28. data/spec/inversion/renderstate_spec.rb +242 -165
  29. data/spec/inversion/template/attrtag_spec.rb +10 -18
  30. data/spec/inversion/template/begintag_spec.rb +13 -12
  31. data/spec/inversion/template/configtag_spec.rb +5 -7
  32. data/spec/inversion/template/elsetag_spec.rb +5 -5
  33. data/spec/inversion/template/elsiftag_spec.rb +5 -5
  34. data/spec/inversion/template/endtag_spec.rb +1 -1
  35. data/spec/inversion/template/fortag_spec.rb +22 -1
  36. data/spec/inversion/template/iftag_spec.rb +14 -0
  37. data/spec/inversion/template/rescuetag_spec.rb +4 -4
  38. data/spec/inversion/template/tag_spec.rb +6 -4
  39. data/spec/inversion/template/unlesstag_spec.rb +12 -6
  40. data/spec/inversion/template/yieldtag_spec.rb +2 -2
  41. metadata +31 -32
  42. metadata.gz.sig +0 -0
  43. data/lib/inversion/template/conditionaltag.rb +0 -49
@@ -99,18 +99,18 @@ describe Inversion::Template::AttrTag do
99
99
  end
100
100
 
101
101
  it "renders as the stringified contents of the template attribute with the same name" do
102
- template = stub( "template object", :attributes => {:foo => %w[floppy the turtle]} )
103
- @tag.render( template ).should == ["floppy", "the", "turtle"]
102
+ state = Inversion::RenderState.new( :foo => %w[floppy the turtle] )
103
+ @tag.render( state ).should == ["floppy", "the", "turtle"]
104
104
  end
105
105
 
106
106
  it "doesn't error if the attribute isn't set on the template" do
107
- template = stub( "template object", :attributes => { :foo => nil } )
108
- @tag.render( template ).should == nil
107
+ state = Inversion::RenderState.new( :foo => nil )
108
+ @tag.render( state ).should == nil
109
109
  end
110
110
 
111
111
  it "returns false when the rendered value is false" do
112
- template = stub( "template object", :attributes => { :foo => false } )
113
- @tag.render( template ).should equal( false )
112
+ state = Inversion::RenderState.new( :foo => false )
113
+ @tag.render( state ).should equal( false )
114
114
  end
115
115
 
116
116
  it "can render itself as a comment for template debugging" do
@@ -127,21 +127,13 @@ describe Inversion::Template::AttrTag do
127
127
  end
128
128
 
129
129
  it "renders as the formatted contents of the template attribute with the same name" do
130
- attributes = double( "template object attributes" )
131
- template = stub( "template object", :attributes => attributes )
132
-
133
- attributes.should_receive( :[] ).with( :foo ).and_return( Math::PI )
134
-
135
- @tag.render( template ).should == '3.14'
130
+ state = Inversion::RenderState.new( :foo => Math::PI )
131
+ @tag.render( state ).should == '3.14'
136
132
  end
137
133
 
138
134
  it "doesn't error if the attribute isn't set on the template" do
139
- attributes = double( "template object attributes" )
140
- template = stub( "template object", :attributes => attributes )
141
-
142
- attributes.should_receive( :[] ).with( :foo ).and_return( nil )
143
-
144
- @tag.render( template ).should == nil
135
+ state = Inversion::RenderState.new( :foo => nil )
136
+ @tag.render( state ).should == nil
145
137
  end
146
138
 
147
139
  it "can render itself as a comment for template debugging" do
@@ -39,13 +39,13 @@ describe Inversion::Template::BeginTag do
39
39
  @tag << Inversion::Template::TextNode.new( ':the stuff after the attr' )
40
40
  end
41
41
 
42
- it "should render its subnodes as-is if none of them raise an exception" do
42
+ it "renders its subnodes as-is if none of them raise an exception" do
43
43
  renderstate = Inversion::RenderState.new( :foo => OpenStruct.new(:baz => 'the body') )
44
44
  renderstate << @tag
45
45
  renderstate.to_s.should == 'the body:the stuff after the attr'
46
46
  end
47
47
 
48
- it "should use the configured error behavior of the template if a subnode raises any exception" do
48
+ it "uses the configured error behavior of the template if a subnode raises any exception" do
49
49
  renderstate = Inversion::RenderState.new
50
50
  renderstate << @tag
51
51
  renderstate.to_s.should =~ /NoMethodError/
@@ -74,13 +74,13 @@ describe Inversion::Template::BeginTag do
74
74
  @tag.rescue_clauses.should == [ [[::RuntimeError], [@rescue_textnode]] ]
75
75
  end
76
76
 
77
- it "should render its subnodes as-is if none of them raise an exception" do
77
+ it "renders its subnodes as-is if none of them raise an exception" do
78
78
  renderstate = Inversion::RenderState.new( :foo => OpenStruct.new(:baz => 'the body') )
79
79
  renderstate << @tag
80
80
  renderstate.to_s.should == 'the body:the stuff after the attr'
81
81
  end
82
82
 
83
- it "should render the rescue section if a subnode raises a RuntimeError" do
83
+ it "renders the rescue section if a subnode raises a RuntimeError" do
84
84
  fooobj = Object.new
85
85
  def fooobj.baz; raise "An exception"; end
86
86
 
@@ -89,7 +89,7 @@ describe Inversion::Template::BeginTag do
89
89
  renderstate.to_s.should == 'rescue stuff'
90
90
  end
91
91
 
92
- it "should use the configured error behavior of the template if a subnode raises an " +
92
+ it "uses the configured error behavior of the template if a subnode raises an " +
93
93
  "exception other than RuntimeError" do
94
94
  fooobj = Object.new
95
95
  def fooobj.baz; raise Errno::ENOENT, "No such file or directory"; end
@@ -105,6 +105,7 @@ describe Inversion::Template::BeginTag do
105
105
 
106
106
  context "with a single rescue clause with an exception type" do
107
107
  before( :each ) do
108
+
108
109
  @tag = Inversion::Template::BeginTag.new( ' ' )
109
110
 
110
111
  @attrtag = Inversion::Template::AttrTag.new( 'foo.baz' )
@@ -122,13 +123,13 @@ describe Inversion::Template::BeginTag do
122
123
  @tag.rescue_clauses.should == [ [[::SystemCallError], [@rescue_textnode]] ]
123
124
  end
124
125
 
125
- it "should render its subnodes as-is if none of them raise an exception" do
126
+ it "renders its subnodes as-is if none of them raise an exception" do
126
127
  renderstate = Inversion::RenderState.new( :foo => OpenStruct.new(:baz => 'the body') )
127
128
  renderstate << @tag
128
129
  renderstate.to_s.should == 'the body:the stuff after the attr'
129
130
  end
130
131
 
131
- it "should render the rescue section if a subnode raises the specified exception type" do
132
+ it "renders the rescue section if a subnode raises the specified exception type" do
132
133
  fooobj = Object.new
133
134
  def fooobj.baz; raise Errno::ENOENT, "no such file or directory"; end
134
135
 
@@ -137,7 +138,7 @@ describe Inversion::Template::BeginTag do
137
138
  renderstate.to_s.should == 'rescue stuff'
138
139
  end
139
140
 
140
- it "should use the configured error behavior of the template if a subnode raises an " +
141
+ it "uses the configured error behavior of the template if a subnode raises an " +
141
142
  "exception other than the specified type" do
142
143
  fooobj = Object.new
143
144
  def fooobj.baz; raise "SPlat!"; end
@@ -175,13 +176,13 @@ describe Inversion::Template::BeginTag do
175
176
  ]
176
177
  end
177
178
 
178
- it "should render its subnodes as-is if none of them raise an exception" do
179
+ it "renders its subnodes as-is if none of them raise an exception" do
179
180
  renderstate = Inversion::RenderState.new( :foo => OpenStruct.new(:baz => 'the body') )
180
181
  renderstate << @tag
181
182
  renderstate.to_s.should == 'the body:the stuff after the attr'
182
183
  end
183
184
 
184
- it "should render the first rescue section if a subnode raises the exception it " +
185
+ it "renders the first rescue section if a subnode raises the exception it " +
185
186
  "specifies" do
186
187
  fooobj = Object.new
187
188
  def fooobj.baz; raise "An exception"; end
@@ -191,7 +192,7 @@ describe Inversion::Template::BeginTag do
191
192
  renderstate.to_s.should == 'rescue stuff'
192
193
  end
193
194
 
194
- it "should render the second rescue section if a subnode raises the exception it " +
195
+ it "renders the second rescue section if a subnode raises the exception it " +
195
196
  "specifies" do
196
197
  fooobj = Object.new
197
198
  def fooobj.baz; raise Errno::ENOENT, "no such file or directory"; end
@@ -201,7 +202,7 @@ describe Inversion::Template::BeginTag do
201
202
  renderstate.to_s.should == 'alternative rescue stuff'
202
203
  end
203
204
 
204
- it "should use the configured error behavior of the template if a subnode raises an " +
205
+ it "uses the configured error behavior of the template if a subnode raises an " +
205
206
  "exception other than those specified by the rescue clauses" do
206
207
  fooobj = Object.new
207
208
  def fooobj.baz; raise Errno::ENOMEM, "All out!"; end
@@ -86,17 +86,15 @@ describe Inversion::Template::ConfigTag do
86
86
  }.to raise_exception( Inversion::ParseError, /unknown tag "what"/i )
87
87
  end
88
88
 
89
- it "can change the strictness of the parser as it's parsing the template" do
89
+ it "can turn on debugging comments in rendered output" do
90
90
  source = <<-TEMPLATE
91
- <?hooooowhat ?>
92
- <?config ignore_unknown_tags: false ?>
91
+ <?config debugging_comments: true ?>
93
92
  something
94
- <?what ?>
93
+ <?if foo ?>Van!<?end if ?>
95
94
  something else
96
95
  TEMPLATE
97
- expect {
98
- Inversion::Template.new( source, :ignore_unknown_tags => true )
99
- }.to raise_exception( Inversion::ParseError, /unknown tag "what"/i )
96
+ tmpl = Inversion::Template.new( source )
97
+ tmpl.render.should include( "<!-- If: { template.foo } -->" )
100
98
  end
101
99
 
102
100
  end
@@ -35,7 +35,7 @@ describe Inversion::Template::ElseTag do
35
35
 
36
36
  it "can be appended to an 'if' tag" do
37
37
  template = double( "template object" )
38
- parserstate = Inversion::Template::Parser::State.new( template )
38
+ parserstate = Inversion::Parser::State.new( template )
39
39
  iftag = Inversion::Template::IfTag.new( 'foo' )
40
40
  elsetag = Inversion::Template::ElseTag.new
41
41
  endtag = Inversion::Template::EndTag.new
@@ -47,7 +47,7 @@ describe Inversion::Template::ElseTag do
47
47
 
48
48
  it "can be appended to an 'unless' tag" do
49
49
  template = double( "template object" )
50
- parserstate = Inversion::Template::Parser::State.new( template )
50
+ parserstate = Inversion::Parser::State.new( template )
51
51
  unlesstag = Inversion::Template::UnlessTag.new( 'foo' )
52
52
  elsetag = Inversion::Template::ElseTag.new
53
53
  endtag = Inversion::Template::EndTag.new
@@ -60,7 +60,7 @@ describe Inversion::Template::ElseTag do
60
60
 
61
61
  it "can be appended to a 'comment' tag" do
62
62
  template = double( "template object" )
63
- parserstate = Inversion::Template::Parser::State.new( template )
63
+ parserstate = Inversion::Parser::State.new( template )
64
64
  commenttag = Inversion::Template::CommentTag.new( 'else section for later' )
65
65
  elsetag = Inversion::Template::ElseTag.new
66
66
  endtag = Inversion::Template::EndTag.new
@@ -74,7 +74,7 @@ describe Inversion::Template::ElseTag do
74
74
  it "raises an error if it's about to be appended to anything other than an 'if', 'unless', " +
75
75
  "or 'comment' tag" do
76
76
  template = double( "template object" )
77
- parserstate = Inversion::Template::Parser::State.new( template )
77
+ parserstate = Inversion::Parser::State.new( template )
78
78
  parserstate << Inversion::Template::ForTag.new( 'foo in bar' )
79
79
 
80
80
  expect {
@@ -85,7 +85,7 @@ describe Inversion::Template::ElseTag do
85
85
 
86
86
  it "raises an error if it's about to be appended without an opening 'if' or 'unless'" do
87
87
  template = double( "template object" )
88
- parserstate = Inversion::Template::Parser::State.new( template )
88
+ parserstate = Inversion::Parser::State.new( template )
89
89
 
90
90
  expect {
91
91
  parserstate << Inversion::Template::ElseTag.new
@@ -31,7 +31,7 @@ describe Inversion::Template::ElsifTag do
31
31
 
32
32
  it "can be appended to an 'if' tag" do
33
33
  template = double( "template object" )
34
- parserstate = Inversion::Template::Parser::State.new( template )
34
+ parserstate = Inversion::Parser::State.new( template )
35
35
  iftag = Inversion::Template::IfTag.new( 'foo' )
36
36
  elsetag = Inversion::Template::ElsifTag.new( 'bar' )
37
37
  endtag = Inversion::Template::EndTag.new
@@ -43,7 +43,7 @@ describe Inversion::Template::ElsifTag do
43
43
 
44
44
  it "can be appended to a 'comment' tag" do
45
45
  template = double( "template object" )
46
- parserstate = Inversion::Template::Parser::State.new( template )
46
+ parserstate = Inversion::Parser::State.new( template )
47
47
  commenttag = Inversion::Template::CommentTag.new( 'else section for later' )
48
48
  elsetag = Inversion::Template::ElsifTag.new( 'bar' )
49
49
  endtag = Inversion::Template::EndTag.new
@@ -56,7 +56,7 @@ describe Inversion::Template::ElsifTag do
56
56
 
57
57
  it "raises an error if it's about to be appended to anything other than an 'if' or 'comment' tag" do
58
58
  template = double( "template object" )
59
- parserstate = Inversion::Template::Parser::State.new( template )
59
+ parserstate = Inversion::Parser::State.new( template )
60
60
  parserstate << Inversion::Template::UnlessTag.new( 'foo in bar' )
61
61
 
62
62
  expect {
@@ -67,7 +67,7 @@ describe Inversion::Template::ElsifTag do
67
67
 
68
68
  it "raises an error if it's about to be appended without an opening 'if'" do
69
69
  template = double( "template object" )
70
- parserstate = Inversion::Template::Parser::State.new( template )
70
+ parserstate = Inversion::Parser::State.new( template )
71
71
 
72
72
  expect {
73
73
  parserstate << Inversion::Template::ElsifTag.new( 'bar' )
@@ -78,7 +78,7 @@ describe Inversion::Template::ElsifTag do
78
78
  it "renders as its attribute value if it's a simple attribute" do
79
79
  renderstate = Inversion::RenderState.new( :bar => :the_attribute_value )
80
80
  tag = Inversion::Template::ElsifTag.new( 'bar' )
81
- tag.render( renderstate ).should == :the_attribute_value
81
+ tag.evaluate( renderstate ).should == :the_attribute_value
82
82
  end
83
83
 
84
84
  end
@@ -61,7 +61,7 @@ describe Inversion::Template::EndTag do
61
61
  end
62
62
 
63
63
  it "raises an error on the addition of a mismatched end tag" do
64
- state = Inversion::Template::Parser::State.new( :template )
64
+ state = Inversion::Parser::State.new( :template )
65
65
  opener = Inversion::Template::ForTag.new( 'foo in bar' )
66
66
  state << opener
67
67
 
@@ -66,7 +66,28 @@ describe Inversion::Template::ForTag do
66
66
  tag << Inversion::Template::AttrTag.new( 'foo' )
67
67
  tag << Inversion::Template::TextNode.new( ']' )
68
68
 
69
- tag.render( render_state ).should == "[monkey][goat]"
69
+ tag.render( render_state )
70
+ render_state.to_s.should == "[monkey][goat]"
71
+ end
72
+
73
+ it "supports nested iterators" do
74
+ render_state = Inversion::RenderState.new( :tic => [ 'x', 'o'], :tac => ['o', 'x'] )
75
+
76
+ # <?for omarker in tic ?><?for imarker in tac ?>
77
+ outer = Inversion::Template::ForTag.new( 'omarker in tic' )
78
+ inner = Inversion::Template::ForTag.new( 'imarker in tac' )
79
+
80
+ # [<?attr omarker?>, <?attr imarker?>]
81
+ inner << Inversion::Template::TextNode.new( '[' )
82
+ inner << Inversion::Template::AttrTag.new( 'omarker' )
83
+ inner << Inversion::Template::TextNode.new( ', ' )
84
+ inner << Inversion::Template::AttrTag.new( 'imarker' )
85
+ inner << Inversion::Template::TextNode.new( ']' )
86
+
87
+ outer << inner
88
+
89
+ outer.render( render_state )
90
+ render_state.to_s.should == "[x, o][x, x][o, o][o, x]"
70
91
  end
71
92
 
72
93
  it "raises a ParseError if a keyword other than 'in' is used" do
@@ -64,6 +64,20 @@ describe Inversion::Template::IfTag do
64
64
  renderstate.to_s.should == ''
65
65
  end
66
66
 
67
+ it "works inside an iterator (ticket #3)" do
68
+ template = Inversion::Template.new( <<-END_TEMPLATE )
69
+ <?for item in items ?>
70
+ Item: <?if item ?>Yep.<?else?>Nope.<?end?>
71
+ <?end for ?>
72
+ END_TEMPLATE
73
+
74
+ template.items = [ true, false ]
75
+
76
+ template.render.should include( "Item: Yep." )
77
+ template.render.should include( "Item: Nope." )
78
+ end
79
+
80
+
67
81
  context "with a single 'else' clause" do
68
82
 
69
83
  before( :each ) do
@@ -50,7 +50,7 @@ describe Inversion::Template::RescueTag do
50
50
 
51
51
  it "can be appended to a 'begin' tag" do
52
52
  template = double( "template object" )
53
- parserstate = Inversion::Template::Parser::State.new( template )
53
+ parserstate = Inversion::Parser::State.new( template )
54
54
  begintag = Inversion::Template::BeginTag.new
55
55
  rescuetag = Inversion::Template::RescueTag.new
56
56
  textnode = Inversion::Template::TextNode.new( 'Yeah!' )
@@ -64,7 +64,7 @@ describe Inversion::Template::RescueTag do
64
64
 
65
65
  it "can be appended to a 'comment' tag" do
66
66
  template = double( "template object" )
67
- parserstate = Inversion::Template::Parser::State.new( template )
67
+ parserstate = Inversion::Parser::State.new( template )
68
68
  commenttag = Inversion::Template::CommentTag.new( 'rescue section for later' )
69
69
  rescuetag = Inversion::Template::RescueTag.new
70
70
  endtag = Inversion::Template::EndTag.new
@@ -78,7 +78,7 @@ describe Inversion::Template::RescueTag do
78
78
  it "raises an error if it's about to be appended to anything other than a 'begin' or " +
79
79
  "'comment' tag" do
80
80
  template = double( "template object" )
81
- parserstate = Inversion::Template::Parser::State.new( template )
81
+ parserstate = Inversion::Parser::State.new( template )
82
82
  parserstate << Inversion::Template::ForTag.new( 'foo in bar' )
83
83
 
84
84
  expect {
@@ -89,7 +89,7 @@ describe Inversion::Template::RescueTag do
89
89
 
90
90
  it "raises an error if it's about to be appended without an opening 'begin'" do
91
91
  template = double( "template object" )
92
- parserstate = Inversion::Template::Parser::State.new( template )
92
+ parserstate = Inversion::Parser::State.new( template )
93
93
 
94
94
  expect {
95
95
  parserstate << Inversion::Template::RescueTag.new
@@ -35,11 +35,12 @@ describe Inversion::Template::Tag do
35
35
 
36
36
 
37
37
  it "loads pluggable types via Rubygems" do
38
+ pluginfile = '/usr/lib/ruby/gems/1.8/gems/inversion-extra-1.0.8/lib/inversion/template/zebratag.rb'
38
39
  Gem.stub( :find_files ).
39
40
  with( Inversion::Template::Tag::TAG_PLUGIN_PATTERN ).
40
- and_return([ 'inversion/template/zebratag.rb' ])
41
+ and_return([ pluginfile ])
41
42
  Inversion::Template::Tag.should_receive( :require ).
42
- with( 'inversion/template/zebratag.rb' ).
43
+ with( 'inversion/template/zebratag' ).
43
44
  and_return {
44
45
  Class.new( Inversion::Template::Tag ) {
45
46
  def self::name; "ZebraTag"; end
@@ -54,11 +55,12 @@ describe Inversion::Template::Tag do
54
55
  end
55
56
 
56
57
  it "doesn't include abstract tag types in its loading mechanism" do
58
+ pluginfile = '/usr/lib/ruby/gems/1.8/gems/inversion-extra-1.0.8/lib/inversion/template/zebratag.rb'
57
59
  Gem.stub( :find_files ).
58
60
  with( Inversion::Template::Tag::TAG_PLUGIN_PATTERN ).
59
- and_return([ 'inversion/template/zebratag.rb' ])
61
+ and_return([ pluginfile ])
60
62
  Inversion::Template::Tag.should_receive( :require ).
61
- with( 'inversion/template/zebratag.rb' ).
63
+ with( 'inversion/template/zebratag' ).
62
64
  and_return {
63
65
  Class.new( Inversion::Template::Tag ) {
64
66
  include Inversion::AbstractClass
@@ -32,7 +32,8 @@ describe Inversion::Template::UnlessTag do
32
32
  tag << Inversion::Template::TextNode.new( 'the body' )
33
33
 
34
34
  renderstate = Inversion::RenderState.new( :attribute => false )
35
- tag.render( renderstate ).to_s.should == 'the body'
35
+ tag.render( renderstate )
36
+ renderstate.to_s.should == 'the body'
36
37
  end
37
38
 
38
39
  it "renders its contents if its methodchain is false" do
@@ -40,7 +41,8 @@ describe Inversion::Template::UnlessTag do
40
41
  tag << Inversion::Template::TextNode.new( 'the body' )
41
42
 
42
43
  renderstate = Inversion::RenderState.new( :attribute => {:bar => 1} )
43
- tag.render( renderstate ).to_s.should == 'the body'
44
+ tag.render( renderstate )
45
+ renderstate.to_s.should == 'the body'
44
46
  end
45
47
 
46
48
  it "doesn't render its contents if its attribute is true" do
@@ -48,7 +50,8 @@ describe Inversion::Template::UnlessTag do
48
50
  tag << Inversion::Template::TextNode.new( 'the body' )
49
51
 
50
52
  renderstate = Inversion::RenderState.new( :attribute => true )
51
- tag.render( renderstate ).to_s.should == ''
53
+ tag.render( renderstate )
54
+ renderstate.to_s.should == ''
52
55
  end
53
56
 
54
57
  it "doesn't render its contents if its methodchain is true" do
@@ -56,7 +59,8 @@ describe Inversion::Template::UnlessTag do
56
59
  tag << Inversion::Template::TextNode.new( 'the body' )
57
60
 
58
61
  renderstate = Inversion::RenderState.new( :attribute => {:foo => 1} )
59
- tag.render( renderstate ).to_s.should == ''
62
+ tag.render( renderstate )
63
+ renderstate.to_s.should == ''
60
64
  end
61
65
 
62
66
  context "with an 'else' clause" do
@@ -71,12 +75,14 @@ describe Inversion::Template::UnlessTag do
71
75
 
72
76
  it "only renders the second half of the contents if its attribute is true" do
73
77
  renderstate = Inversion::RenderState.new( :attribute => true )
74
- @tag.render( renderstate ).to_s.should == 'the body after else'
78
+ @tag.render( renderstate )
79
+ renderstate.to_s.should == 'the body after else'
75
80
  end
76
81
 
77
82
  it "only renders the first half of the contents if its attribute is false" do
78
83
  renderstate = Inversion::RenderState.new( :attribute => false )
79
- @tag.render( renderstate ).to_s.should == 'the body before else'
84
+ @tag.render( renderstate )
85
+ renderstate.to_s.should == 'the body before else'
80
86
  end
81
87
 
82
88
  end