aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorYehuda Katz <wycats@Yehuda-Katz.local>2009-11-09 10:57:20 -0800
committerYehuda Katz <wycats@Yehuda-Katz.local>2009-11-09 10:57:20 -0800
commit790c062280c0d23c2033e4983c13d402c0424f2a (patch)
tree7b652b420411779072c2371a42e84c83525f63b1 /actionpack
parent51fe6d05e73a4e0f8481f4e441f4ca886d65a69c (diff)
parent303991288633effea5a1d1774dbd861951303fe5 (diff)
downloadrails-790c062280c0d23c2033e4983c13d402c0424f2a.tar.gz
rails-790c062280c0d23c2033e4983c13d402c0424f2a.tar.bz2
rails-790c062280c0d23c2033e4983c13d402c0424f2a.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack')
-rwxr-xr-xactionpack/lib/action_dispatch/http/request.rb2
-rw-r--r--actionpack/lib/action_view/test_case.rb1
-rw-r--r--actionpack/test/dispatch/request_test.rb4
-rw-r--r--actionpack/test/template/test_case_test.rb13
4 files changed, 15 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index 9314ff5c53..c24b404e2f 100755
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -167,7 +167,7 @@ module ActionDispatch
@env["action_dispatch.request.formats"] ||=
if parameters[:format]
- [Mime[parameters[:format]]]
+ Array.wrap(Mime[parameters[:format]])
elsif xhr? || (accept && !accept.include?(?,))
accepts
else
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index 8beda24aba..86bbad822d 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -120,6 +120,7 @@ module ActionView
def _view
view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
view.class.send :include, _helpers
+ view.output_buffer = self.output_buffer
view
end
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 239fda98e0..b62df9a6b2 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -432,6 +432,10 @@ class RequestTest < ActiveSupport::TestCase
request = stub_request
request.expects(:parameters).at_least_once.returns({ :format => :txt })
assert_equal with_set(Mime::TEXT), request.formats
+
+ request = stub_request
+ request.expects(:parameters).at_least_once.returns({ :format => :unknown })
+ assert request.formats.empty?
end
test "negotiate_mime" do
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index ca72c13ffa..05a409d05a 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -24,7 +24,7 @@ module ActionView
test_case.class_eval do
test "helpers defined on ActionView::TestCase are available" do
assert test_case.ancestors.include?(ASharedTestHelper)
- assert 'Holla!', from_shared_helper
+ assert_equal 'Holla!', from_shared_helper
end
end
end
@@ -38,10 +38,15 @@ module ActionView
assert_equal 'Eloy', render('developers/developer', :developer => stub(:name => 'Eloy'))
end
+ test "can render a layout with block" do
+ assert_equal "Before (ChrisCruft)\n!\nAfter",
+ render(:layout => "test/layout_for_partial", :locals => {:name => "ChrisCruft"}) {"!"}
+ end
+
helper AnotherTestHelper
test "additional helper classes can be specified as in a controller" do
assert test_case.ancestors.include?(AnotherTestHelper)
- assert 'Howdy!', from_another_helper
+ assert_equal 'Howdy!', from_another_helper
end
end
@@ -58,14 +63,14 @@ module ActionView
helper AnotherTestHelper
test "additional helper classes can be specified as in a controller" do
assert test_case.ancestors.include?(AnotherTestHelper)
- assert 'Howdy!', from_another_helper
+ assert_equal 'Howdy!', from_another_helper
test_case.helper_class.module_eval do
def render_from_helper
from_another_helper
end
end
- assert 'Howdy!', render(:partial => 'test/from_helper')
+ assert_equal 'Howdy!', render(:partial => 'test/from_helper')
end
end