提交 dd6b0c2a 编写于 作者: V Vipul A M

Fixed test for deprecation warning in actionview, renaming from...

Fixed test for deprecation warning in actionview, renaming from https://github.com/rails/rails/commit/baf14ae513337cb185acf865e93dfc48f3aabf6a
上级 33030ea7
......@@ -957,12 +957,12 @@ def test_nested_rendering
end
def test_accessing_params_in_template
get :accessing_params_in_template, :name => "David"
get :accessing_params_in_template, params: { name: "David" }
assert_equal "Hello: David", @response.body
end
def test_accessing_local_assigns_in_inline_template
get :accessing_local_assigns_in_inline_template, :local_name => "Local David"
get :accessing_local_assigns_in_inline_template, params: { local_name: "Local David" }
assert_equal "Goodbye, Local David", @response.body
assert_equal "text/html", @response.content_type
end
......@@ -1046,7 +1046,7 @@ def test_render_to_string_that_throws_caught_exception_doesnt_break_assigns
end
def test_accessing_params_in_template_with_layout
get :accessing_params_in_template_with_layout, :name => "David"
get :accessing_params_in_template_with_layout, params: { name: "David" }
assert_equal "<html>Hello: David</html>", @response.body
end
......
......@@ -231,28 +231,28 @@ def setup
def test_feed_should_use_default_language_if_none_is_given
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_match(%r{xml:lang="en-US"}, @response.body)
end
end
def test_feed_should_include_two_entries
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_select "entry", 2
end
end
def test_entry_should_only_use_published_if_created_at_is_present
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_select "published", 1
end
end
def test_providing_builder_to_atom_feed
with_restful_routing(:scrolls) do
get :index, :id=>"provide_builder"
get :index, params: { id: "provide_builder" }
# because we pass in the non-default builder, the content generated by the
# helper should go 'nowhere'. Leaving the response body blank.
assert @response.body.blank?
......@@ -261,7 +261,7 @@ def test_providing_builder_to_atom_feed
def test_entry_with_prefilled_options_should_use_those_instead_of_querying_the_record
with_restful_routing(:scrolls) do
get :index, :id => "entry_options"
get :index, params: { id: "entry_options" }
assert_select "updated", Time.utc(2007, 1, 1).xmlschema
assert_select "updated", Time.utc(2007, 1, 2).xmlschema
......@@ -270,21 +270,21 @@ def test_entry_with_prefilled_options_should_use_those_instead_of_querying_the_r
def test_self_url_should_default_to_current_request_url
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_select "link[rel=self][href=\"http://www.nextangle.com/scrolls?id=defaults\"]"
end
end
def test_feed_id_should_be_a_valid_tag
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_select "id", :text => "tag:www.nextangle.com,2008:/scrolls?id=defaults"
end
end
def test_entry_id_should_be_a_valid_tag
with_restful_routing(:scrolls) do
get :index, :id => "defaults"
get :index, params: { id: "defaults" }
assert_select "entry id", :text => "tag:www.nextangle.com,2008:Scroll/1"
assert_select "entry id", :text => "tag:www.nextangle.com,2008:Scroll/2"
end
......@@ -292,14 +292,14 @@ def test_entry_id_should_be_a_valid_tag
def test_feed_should_allow_nested_xml_blocks
with_restful_routing(:scrolls) do
get :index, :id => "xml_block"
get :index, params: { id: "xml_block" }
assert_select "author name", :text => "DHH"
end
end
def test_feed_should_include_atomPub_namespace
with_restful_routing(:scrolls) do
get :index, :id => "feed_with_atomPub_namespace"
get :index, params: { id: "feed_with_atomPub_namespace" }
assert_match %r{xml:lang="en-US"}, @response.body
assert_match %r{xmlns="http://www.w3.org/2005/Atom"}, @response.body
assert_match %r{xmlns:app="http://www.w3.org/2007/app"}, @response.body
......@@ -308,7 +308,7 @@ def test_feed_should_include_atomPub_namespace
def test_feed_should_allow_overriding_ids
with_restful_routing(:scrolls) do
get :index, :id => "feed_with_overridden_ids"
get :index, params: { id: "feed_with_overridden_ids" }
assert_select "id", :text => "tag:test.rubyonrails.org,2008:test/"
assert_select "entry id", :text => "tag:test.rubyonrails.org,2008:1"
assert_select "entry id", :text => "tag:test.rubyonrails.org,2008:2"
......@@ -317,7 +317,7 @@ def test_feed_should_allow_overriding_ids
def test_feed_xml_processing_instructions
with_restful_routing(:scrolls) do
get :index, :id => 'feed_with_xml_processing_instructions'
get :index, params: { id: 'feed_with_xml_processing_instructions' }
assert_match %r{<\?xml-stylesheet [^\?]*type="text/css"}, @response.body
assert_match %r{<\?xml-stylesheet [^\?]*href="t.css"}, @response.body
end
......@@ -325,7 +325,7 @@ def test_feed_xml_processing_instructions
def test_feed_xml_processing_instructions_duplicate_targets
with_restful_routing(:scrolls) do
get :index, :id => 'feed_with_xml_processing_instructions_duplicate_targets'
get :index, params: { id: 'feed_with_xml_processing_instructions_duplicate_targets' }
assert_match %r{<\?target1 (a="1" b="2"|b="2" a="1")\?>}, @response.body
assert_match %r{<\?target1 (c="3" d="4"|d="4" c="3")\?>}, @response.body
end
......@@ -333,7 +333,7 @@ def test_feed_xml_processing_instructions_duplicate_targets
def test_feed_xhtml
with_restful_routing(:scrolls) do
get :index, :id => "feed_with_xhtml_content"
get :index, params: { id: "feed_with_xhtml_content" }
assert_match %r{xmlns="http://www.w3.org/1999/xhtml"}, @response.body
assert_select "summary", :text => /Something Boring/
assert_select "summary", :text => /after 2/
......@@ -342,21 +342,21 @@ def test_feed_xhtml
def test_feed_entry_type_option_default_to_text_html
with_restful_routing(:scrolls) do
get :index, :id => 'defaults'
get :index, params: { id: 'defaults' }
assert_select "entry link[rel=alternate][type=\"text/html\"]"
end
end
def test_feed_entry_type_option_specified
with_restful_routing(:scrolls) do
get :index, :id => 'entry_type_options'
get :index, params: { id: 'entry_type_options' }
assert_select "entry link[rel=alternate][type=\"text/xml\"]"
end
end
def test_feed_entry_url_false_option_adds_no_link
with_restful_routing(:scrolls) do
get :index, :id => 'entry_url_false_option'
get :index, params: { id: 'entry_url_false_option' }
assert_select "entry link", false
end
end
......
......@@ -624,13 +624,13 @@ def test_overridden_url_for_shows_only_path
end
def test_named_route_url_shows_host_and_path
get :show_named_route, kind: 'url'
get :show_named_route, params: { kind: 'url' }
assert_equal 'http://test.host/url_helper_controller_test/url_helper/show_named_route',
@response.body
end
def test_named_route_path_shows_only_path
get :show_named_route, kind: 'path'
get :show_named_route, params: { kind: 'path' }
assert_equal '/url_helper_controller_test/url_helper/show_named_route', @response.body
end
......@@ -646,7 +646,7 @@ def default_url_options
end
end
get :show_named_route, kind: 'url'
get :show_named_route, params: { kind: 'url' }
assert_equal 'http://testtwo.host/url_helper_controller_test/url_helper/show_named_route', @response.body
end
......@@ -661,11 +661,11 @@ def test_recall_params_should_not_be_changed
end
def test_recall_params_should_normalize_id
get :show, id: '123'
get :show, params: { id: '123' }
assert_equal 302, @response.status
assert_equal 'http://test.host/url_helper_controller_test/url_helper/profile/123', @response.location
get :show, name: '123'
get :show, params: { name: '123' }
assert_equal 'ok', @response.body
end
......@@ -704,7 +704,7 @@ def test_link_to_unless_current_to_current
end
def test_link_to_unless_current_shows_link
get :show, id: 1
get :show, params: { id: 1 }
assert_equal %{<a href="/tasks">tasks</a>\n} +
%{<a href="#{@request.protocol}#{@request.host_with_port}/tasks">tasks</a>},
@response.body
......@@ -778,21 +778,21 @@ def test_new_resource
def test_existing_resource
@controller = WorkshopsController.new
get :show, id: 1
get :show, params: { id: 1 }
assert_equal %{/workshops/1\n<a href="/workshops/1">Workshop</a>}, @response.body
end
def test_new_nested_resource
@controller = SessionsController.new
get :index, workshop_id: 1
get :index, params: { workshop_id: 1 }
assert_equal %{/workshops/1/sessions\n<a href="/workshops/1/sessions">Session</a>}, @response.body
end
def test_existing_nested_resource
@controller = SessionsController.new
get :show, workshop_id: 1, id: 1
get :show, params: { workshop_id: 1, id: 1 }
assert_equal %{/workshops/1/sessions/1\n<a href="/workshops/1/sessions/1">Session</a>}, @response.body
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册