mirror of
https://github.com/github/rails.git
synced 2026-02-18 01:51:49 -05:00
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6499 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
47 lines
2.1 KiB
Ruby
47 lines
2.1 KiB
Ruby
require "#{File.dirname(__FILE__)}/../abstract_unit"
|
|
require "#{File.dirname(__FILE__)}/../testing_sandbox"
|
|
|
|
class ActionViewTemplateTest < Test::Unit::TestCase
|
|
include TestingSandbox
|
|
|
|
uses_mocha "Action View Templates" do
|
|
def setup
|
|
@template = ActionView::Base.new
|
|
end
|
|
|
|
def test_should_find_delegated_extension
|
|
@template.expects(:delegate_template_exists?).with('foo').returns(['foo'])
|
|
assert_equal :foo, @template.send(:find_template_extension_for, 'foo')
|
|
end
|
|
|
|
def test_should_find_formatted_erb_extension
|
|
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:formatted_template_exists?).with('foo.html').returns("erb")
|
|
assert_equal "html.erb", @template.send(:find_template_extension_for, 'foo')
|
|
end
|
|
|
|
def test_should_find_erb_extension
|
|
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
|
|
@template.expects(:erb_template_exists?).with('foo').returns(:erb)
|
|
assert_equal :erb, @template.send(:find_template_extension_for, 'foo')
|
|
end
|
|
|
|
def test_should_find_builder_extension
|
|
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
|
|
@template.expects(:erb_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:builder_template_exists?).with('foo').returns(:builder)
|
|
assert_equal :builder, @template.send(:find_template_extension_for, 'foo')
|
|
end
|
|
|
|
def test_should_find_javascript_extension
|
|
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
|
|
@template.expects(:erb_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:builder_template_exists?).with('foo').returns(nil)
|
|
@template.expects(:javascript_template_exists?).with('foo').returns(true)
|
|
assert_equal :rjs, @template.send(:find_template_extension_for, 'foo')
|
|
end
|
|
end
|
|
end |