Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed routes to use new API in a few more actionpack tests

  • Loading branch information...
commit c15bb4901b4c33667d56ad4a2ffbeaa3fb0f9b88 1 parent 442e549
@drogus drogus authored
View
12 actionpack/test/controller/new_base/content_type_test.rb
@@ -42,10 +42,16 @@ def set_as_nil_on_response_obj
class ExplicitContentTypeTest < Rack::TestCase
test "default response is HTML and UTF8" do
- get "/content_type/base"
+ with_routing do |set|
+ set.draw do
+ match ':controller', :action => 'index'
+ end
- assert_body "Hello world!"
- assert_header "Content-Type", "text/html; charset=utf-8"
+ get "/content_type/base"
+
+ assert_body "Hello world!"
+ assert_header "Content-Type", "text/html; charset=utf-8"
+ end
end
test "setting the content type of the response directly on the response object" do
View
10 actionpack/test/controller/new_base/render_template_test.rb
@@ -123,10 +123,14 @@ class TestWithLayout < Rack::TestCase
describe "Rendering with :template using implicit or explicit layout"
test "rendering with implicit layout" do
- get "/render_template/with_layout"
+ with_routing do |set|
+ set.draw { match ':controller', :action => :index }
- assert_body "Hello from basic.html.erb, I'm here!"
- assert_status 200
+ get "/render_template/with_layout"
+
+ assert_body "Hello from basic.html.erb, I'm here!"
+ assert_status 200
+ end
end
test "rendering with layout => :true" do
View
22 actionpack/test/controller/new_base/render_test.rb
@@ -37,15 +37,27 @@ def index
class RenderTest < Rack::TestCase
test "render with blank" do
- get "/render/blank_render"
+ with_routing do |set|
+ set.draw do
+ match ":controller", :action => 'index'
+ end
- assert_body "Hello world!"
- assert_status 200
+ get "/render/blank_render"
+
+ assert_body "Hello world!"
+ assert_status 200
+ end
end
test "rendering more than once raises an exception" do
- assert_raises(AbstractController::DoubleRenderError) do
- get "/render/double_render", {}, "action_dispatch.show_exceptions" => false
+ with_routing do |set|
+ set.draw do
+ match ":controller", :action => 'index'
+ end
+
+ assert_raises(AbstractController::DoubleRenderError) do
+ get "/render/double_render", {}, "action_dispatch.show_exceptions" => false
+ end
end
end
end
View
20 actionpack/test/controller/new_base/render_text_test.rb
@@ -66,16 +66,24 @@ class RenderTextTest < Rack::TestCase
describe "Rendering text using render :text"
test "rendering text from a action with default options renders the text with the layout" do
- get "/render_text/simple"
- assert_body "hello david"
- assert_status 200
+ with_routing do |set|
+ set.draw { match ':controller', :action => 'index' }
+
+ get "/render_text/simple"
+ assert_body "hello david"
+ assert_status 200
+ end
end
test "rendering text from a action with default options renders the text without the layout" do
- get "/render_text/with_layout"
+ with_routing do |set|
+ set.draw { match ':controller', :action => 'index' }
- assert_body "hello david"
- assert_status 200
+ get "/render_text/with_layout"
+
+ assert_body "hello david"
+ assert_status 200
+ end
end
test "rendering text, while also providing a custom status code" do
View
10 actionpack/test/controller/test_test.rb
@@ -465,7 +465,15 @@ def test_assert_routing_with_method
end
def test_assert_routing_in_module
- assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
+ with_routing do |set|
+ set.draw do
+ namespace :admin do
+ match 'user' => 'user#index'
+ end
+ end
+
+ assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
+ end
end
def test_assert_routing_with_glob
Please sign in to comment.
Something went wrong with that request. Please try again.