From 428a1ec51d74b102469acc41ad36a64ac9a27d80 Mon Sep 17 00:00:00 2001 From: Simon Rozet Date: Sat, 23 May 2009 16:15:19 +0200 Subject: [PATCH] Add a test for the :views render option --- sinatra.gemspec | 1 + test/templates_test.rb | 6 ++++++ test/views/foo/hello.test | 1 + 3 files changed, 8 insertions(+) create mode 100644 test/views/foo/hello.test diff --git a/sinatra.gemspec b/sinatra.gemspec index c169c99f92..ae50f1f7f6 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -96,6 +96,7 @@ Gem::Specification.new do |s| test/views/error.erb test/views/error.haml test/views/error.sass + test/views/foo/hello.test test/views/hello.builder test/views/hello.erb test/views/hello.haml diff --git a/test/templates_test.rb b/test/templates_test.rb index 9cc663e11b..d2febc9123 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -76,6 +76,12 @@ def with_default_layout assert_equal "X\n= yield\nX\n", @app.templates[:layout][:template] end + it 'loads templates from specified views directory' do + render_app { render :test, :hello, :views => options.views + '/foo' } + + assert_equal "from another views directory\n", body + end + test 'use_in_file_templates simply ignores IO errors' do assert_nothing_raised { mock_app { diff --git a/test/views/foo/hello.test b/test/views/foo/hello.test new file mode 100644 index 0000000000..2aba63411d --- /dev/null +++ b/test/views/foo/hello.test @@ -0,0 +1 @@ +from another views directory