aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-04-01 22:29:19 +0000
committerRick Olson <technoweenie@gmail.com>2007-04-01 22:29:19 +0000
commitcf865196fec17d337640b4bca5cb16ca7c67f62f (patch)
tree4e6b56180cd1abb11f0a3034536c5e65bd3504d8 /actionpack/test/template
parent67d5a1abedaae4c2ccc5057bb6780708f04b5f10 (diff)
downloadrails-cf865196fec17d337640b4bca5cb16ca7c67f62f.tar.gz
rails-cf865196fec17d337640b4bca5cb16ca7c67f62f.tar.bz2
rails-cf865196fec17d337640b4bca5cb16ca7c67f62f.zip
add ActionView::Base#find_template_extension_for tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6498 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/base_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/template/base_test.rb b/actionpack/test/template/base_test.rb
new file mode 100644
index 0000000000..754c38f393
--- /dev/null
+++ b/actionpack/test/template/base_test.rb
@@ -0,0 +1,38 @@
+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_erb_extension
+ @template.expects(:delegate_template_exists?).with('foo').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(: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(: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 \ No newline at end of file