From 45efb665f0dc10cd6f8e186b06765693fda6251b Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 15 Jun 2012 20:36:09 +0200 Subject: Add ActionView::Base.default_formats default_formats array is used by LookupContext in order to allow rendering templates when :formats option is not passed. Previously it was always set to Mime::SET, which created dependency on Action Pack. In order to remove this dependency, Mime::SET is used only if ActionController is loaded. --- actionpack/test/template/lookup_context_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index ef9c5ce10c..073bd14783 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -11,6 +11,17 @@ class LookupContextTest < ActiveSupport::TestCase I18n.locale = :en end + test "allows to override default_formats with ActionView::Base.default_formats" do + begin + formats = ActionView::Base.default_formats + ActionView::Base.default_formats = [:foo, :bar] + + assert_equal [:foo, :bar], ActionView::LookupContext.new([]).default_formats + ensure + ActionView::Base.default_formats = formats + end + end + test "process view paths on initialization" do assert_kind_of ActionView::PathSet, @lookup_context.view_paths end -- cgit v1.2.3