aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/test_case_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test/template/test_case_test.rb')
-rw-r--r--actionview/test/template/test_case_test.rb40
1 files changed, 20 insertions, 20 deletions
diff --git a/actionview/test/template/test_case_test.rb b/actionview/test/template/test_case_test.rb
index 02167caa71..cd7221ca0e 100644
--- a/actionview/test/template/test_case_test.rb
+++ b/actionview/test/template/test_case_test.rb
@@ -55,12 +55,12 @@ module ActionView
end
test "works without testing a helper module" do
- assert_equal "Eloy", render("developers/developer", :developer => DeveloperStruct.new("Eloy"))
+ assert_equal "Eloy", render("developers/developer", developer: DeveloperStruct.new("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"}) {"!"}
+ render(layout: "test/layout_for_partial", locals: {name: "ChrisCruft"}) {"!"}
end
helper AnotherTestHelper
@@ -110,14 +110,14 @@ module ActionView
from_another_helper
end
end
- assert_equal "Howdy!", render(:partial => "test/from_helper")
+ assert_equal "Howdy!", render(partial: "test/from_helper")
end
end
class HelperInclusionTest < ActionView::TestCase
module RenderHelper
def render_from_helper
- render :partial => "customer", :collection => @customers
+ render partial: "customer", collection: @customers
end
end
@@ -127,14 +127,14 @@ module ActionView
@controller.controller_path = "test"
@customers = [DeveloperStruct.new("Eloy"), DeveloperStruct.new("Manfred")]
- assert_match(/Hello: EloyHello: Manfred/, render(:partial => "test/from_helper"))
+ assert_match(/Hello: EloyHello: Manfred/, render(partial: "test/from_helper"))
end
end
class ControllerHelperMethod < ActionView::TestCase
module SomeHelper
def some_method
- render :partial => "test/from_helper"
+ render partial: "test/from_helper"
end
end
@@ -156,7 +156,7 @@ module ActionView
test "view_assigns returns a Hash of user defined ivars" do
@a = "b"
@c = "d"
- assert_equal({:a => "b", :c => "d"}, view_assigns)
+ assert_equal({a: "b", c: "d"}, view_assigns)
end
test "view_assigns excludes internal ivars" do
@@ -174,7 +174,7 @@ module ActionView
end
end)
test "is able to make methods available to the view" do
- assert_equal "Word!", render(:partial => "test/from_helper")
+ assert_equal "Word!", render(partial: "test/from_helper")
end
def from_test_case; "Word!"; end
@@ -218,14 +218,14 @@ module ActionView
test "is able to use routes" do
controller.request.assign_parameters(@routes, "foo", "index", {}, "/foo", [])
assert_equal "/foo", url_for
- assert_equal "/bar", url_for(:controller => "bar")
+ assert_equal "/bar", url_for(controller: "bar")
end
test "is able to use named routes" do
with_routing do |set|
set.draw { resources :contents }
assert_equal "http://test.host/contents/new", new_content_url
- assert_equal "http://test.host/contents/1", content_url(:id => 1)
+ assert_equal "http://test.host/contents/1", content_url(id: 1)
end
end
@@ -236,7 +236,7 @@ module ActionView
@routes ||= ActionDispatch::Routing::RouteSet.new
end
- routes.draw { get "bar", :to => lambda {} }
+ routes.draw { get "bar", to: lambda {} }
def self.call(*)
end
@@ -257,21 +257,21 @@ module ActionView
end
end
- assert_equal "http://test.host/contents/new", render(:partial => "test/from_helper")
+ assert_equal "http://test.host/contents/new", render(partial: "test/from_helper")
end
end
test "is able to render partials with local variables" do
- assert_equal "Eloy", render("developers/developer", :developer => DeveloperStruct.new("Eloy"))
- assert_equal "Eloy", render(:partial => "developers/developer",
- :locals => { :developer => DeveloperStruct.new("Eloy") })
+ assert_equal "Eloy", render("developers/developer", developer: DeveloperStruct.new("Eloy"))
+ assert_equal "Eloy", render(partial: "developers/developer",
+ locals: { developer: DeveloperStruct.new("Eloy") })
end
test "is able to render partials from templates and also use instance variables" do
@controller.controller_path = "test"
@customers = [DeveloperStruct.new("Eloy"), DeveloperStruct.new("Manfred")]
- assert_match(/Hello: EloyHello: Manfred/, render(:file => "test/list"))
+ assert_match(/Hello: EloyHello: Manfred/, render(file: "test/list"))
end
test "is able to render partials from templates and also use instance variables after view has been referenced" do
@@ -280,7 +280,7 @@ module ActionView
view
@customers = [DeveloperStruct.new("Eloy"), DeveloperStruct.new("Manfred")]
- assert_match(/Hello: EloyHello: Manfred/, render(:file => "test/list"))
+ assert_match(/Hello: EloyHello: Manfred/, render(file: "test/list"))
end
end
@@ -288,16 +288,16 @@ module ActionView
class AssertionsTest < ActionView::TestCase
def render_from_helper
form_tag("/foo") do
- safe_concat render(:text => "<ul><li>foo</li></ul>")
+ safe_concat render(text: "<ul><li>foo</li></ul>")
end
end
helper_method :render_from_helper
test "uses the output_buffer for assert_select" do
- render(:partial => "test/from_helper")
+ render(partial: "test/from_helper")
assert_select "form" do
- assert_select "li", :text => "foo"
+ assert_select "li", text: "foo"
end
end