Skip to content

Commit

Permalink
fix view tests with Rails 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Dec 3, 2008
1 parent 8c871f5 commit 9f1738f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/lib/view_test_process.rb
Expand Up @@ -42,15 +42,21 @@ def paginate(collection = {}, options = {}, &block)

locals = { :collection => collection, :options => options }

if defined? ActionView::InlineTemplate
# Rails 2.1
args = [ ActionView::InlineTemplate.new(@view, @template, locals) ]
unless @view.respond_to? :render_template
# Rails 2.2
@html_result = ActionView::InlineTemplate.new(@template).render(@view, locals)
else
# older Rails versions
args = [nil, @template, nil, locals]
if defined? ActionView::InlineTemplate
# Rails 2.1
args = [ ActionView::InlineTemplate.new(@view, @template, locals) ]
else
# older Rails versions
args = [nil, @template, nil, locals]
end

@html_result = @view.render_template(*args)
end

@html_result = @view.render_template(*args)
@html_document = HTML::Document.new(@html_result, true, false)

if block_given?
Expand Down

0 comments on commit 9f1738f

Please sign in to comment.