diff options
Diffstat (limited to 'actionpack/test/controller/helper_test.rb')
-rw-r--r-- | actionpack/test/controller/helper_test.rb | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index ef85e141a0..981b67f685 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -1,17 +1,17 @@ -require 'abstract_unit' +require "abstract_unit" -ActionController::Base.helpers_path = File.expand_path('../../fixtures/helpers', __FILE__) +ActionController::Base.helpers_path = File.expand_path("../../fixtures/helpers", __FILE__) module Fun class GamesController < ActionController::Base def render_hello_world - render :inline => "hello: <%= stratego %>" + render inline: "hello: <%= stratego %>" end end class PdfController < ActionController::Base def test - render :inline => "test: <%= foobar %>" + render inline: "test: <%= foobar %>" end end end @@ -35,11 +35,11 @@ class JustMeController < ActionController::Base clear_helpers def flash - render :inline => "<h1><%= notice %></h1>" + render inline: "<h1><%= notice %></h1>" end def lib - render :inline => '<%= useful_function %>' + render inline: "<%= useful_function %>" end end @@ -48,7 +48,7 @@ end class HelpersPathsController < ActionController::Base paths = ["helpers2_pack", "helpers1_pack"].map do |path| - File.join(File.expand_path('../../fixtures', __FILE__), path) + File.join(File.expand_path("../../fixtures", __FILE__), path) end $:.unshift(*paths) @@ -56,12 +56,12 @@ class HelpersPathsController < ActionController::Base helper :all def index - render :inline => "<%= conflicting_helper %>" + render inline: "<%= conflicting_helper %>" end end class HelpersTypoController < ActionController::Base - path = File.expand_path('../../fixtures/helpers_typo', __FILE__) + path = File.expand_path("../../fixtures/helpers_typo", __FILE__) $:.unshift(path) self.helpers_path = path end @@ -89,7 +89,7 @@ class HelpersTypoControllerTest < ActiveSupport::TestCase end def test_helper_typo_error_message - e = assert_raise(NameError) { HelpersTypoController.helper 'admin/users' } + e = assert_raise(NameError) { HelpersTypoController.helper "admin/users" } assert_equal "Couldn't find Admin::UsersHelper, expected it to be defined in helpers/admin/users_helper.rb", e.message end @@ -106,7 +106,7 @@ class HelperTest < ActiveSupport::TestCase def setup # Increment symbol counter. - @symbol = (@@counter ||= 'A0').succ!.dup + @symbol = (@@counter ||= "A0").succ!.dup # Generate new controller class. controller_class_name = "Helper#{@symbol}Controller" @@ -139,7 +139,7 @@ class HelperTest < ActiveSupport::TestCase end def test_helper_for_nested_controller - assert_equal 'hello: Iz guuut!', + assert_equal "hello: Iz guuut!", call_controller(Fun::GamesController, "render_hello_world").last.body end @@ -178,7 +178,7 @@ class HelperTest < ActiveSupport::TestCase end def test_all_helpers_with_alternate_helper_dir - @controller_class.helpers_path = File.expand_path('../../fixtures/alternate_helpers', __FILE__) + @controller_class.helpers_path = File.expand_path("../../fixtures/alternate_helpers", __FILE__) # Reload helpers @controller_class._helpers = Module.new @@ -224,9 +224,9 @@ class HelperTest < ActiveSupport::TestCase end def test_helper_proxy_config - AllHelpersController.config.my_var = 'smth' + AllHelpersController.config.my_var = "smth" - assert_equal 'smth', AllHelpersController.helpers.config.my_var + assert_equal "smth", AllHelpersController.helpers.config.my_var end private @@ -243,31 +243,30 @@ class HelperTest < ActiveSupport::TestCase end def test_helper=(helper_module) - silence_warnings { self.class.const_set('TestHelper', helper_module) } + silence_warnings { self.class.const_set("TestHelper", helper_module) } end end - class IsolatedHelpersTest < ActionController::TestCase class A < ActionController::Base def index - render :inline => '<%= shout %>' + render inline: "<%= shout %>" end end class B < A - helper { def shout; 'B' end } + helper { def shout; "B" end } def index - render :inline => '<%= shout %>' + render inline: "<%= shout %>" end end class C < A - helper { def shout; 'C' end } + helper { def shout; "C" end } def index - render :inline => '<%= shout %>' + render inline: "<%= shout %>" end end @@ -277,7 +276,7 @@ class IsolatedHelpersTest < ActionController::TestCase def setup super - @request.action = 'index' + @request.action = "index" end def test_helper_in_a @@ -285,10 +284,10 @@ class IsolatedHelpersTest < ActionController::TestCase end def test_helper_in_b - assert_equal 'B', call_controller(B, "index").last.body + assert_equal "B", call_controller(B, "index").last.body end def test_helper_in_c - assert_equal 'C', call_controller(C, "index").last.body + assert_equal "C", call_controller(C, "index").last.body end end |