instiki/vendor/rails/actionpack/test/action_view_test.rb
Jacques Distler 6873fc8026 Upgrade to Rails 2.0.2
Upgraded to Rails 2.0.2, except that we maintain

   vendor/rails/actionpack/lib/action_controller/routing.rb

from Rail 1.2.6 (at least for now), so that Routes don't change. We still
get to enjoy Rails's many new features.

Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
2007-12-21 01:48:59 -06:00

45 lines
1.3 KiB
Ruby

require File.dirname(__FILE__) + '/abstract_unit'
require 'test/unit'
class ActionViewTests < Test::Unit::TestCase
def test_find_template_extension_from_first_render
base = ActionView::Base.new
assert_nil base.send(:find_template_extension_from_first_render)
{
nil => nil,
'' => nil,
'foo' => nil,
'/foo' => nil,
'foo.rb' => 'rb',
'foo.bar.rb' => 'bar.rb',
'baz/foo.rb' => 'rb',
'baz/foo.bar.rb' => 'bar.rb',
'baz/foo.o/foo.rb' => 'rb',
'baz/foo.o/foo.bar.rb' => 'bar.rb',
}.each do |input,expectation|
base.instance_variable_set('@first_render', input)
assert_equal expectation, base.send(:find_template_extension_from_first_render)
end
end
def test_should_report_file_exists_correctly
base = ActionView::Base.new
assert_nil base.send(:find_template_extension_from_first_render)
assert_equal false, base.send(:file_exists?, 'test.rhtml')
assert_equal false, base.send(:file_exists?, 'test.rb')
base.instance_variable_set('@first_render', 'foo.rb')
assert_equal 'rb', base.send(:find_template_extension_from_first_render)
assert_equal false, base.send(:file_exists?, 'baz')
assert_equal false, base.send(:file_exists?, 'baz.rb')
end
end