aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/abstract
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/abstract')
-rw-r--r--actionpack/test/abstract/callbacks_test.rb41
-rw-r--r--actionpack/test/abstract/collector_test.rb2
-rw-r--r--actionpack/test/abstract/translation_test.rb24
3 files changed, 32 insertions, 35 deletions
diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb
index 07571602e4..a0f2efa330 100644
--- a/actionpack/test/abstract/callbacks_test.rb
+++ b/actionpack/test/abstract/callbacks_test.rb
@@ -1,8 +1,7 @@
-require 'abstract_unit'
+require "abstract_unit"
module AbstractController
module Testing
-
class ControllerWithCallbacks < AbstractController::Base
include AbstractController::Callbacks
end
@@ -114,8 +113,8 @@ module AbstractController
end
class CallbacksWithConditions < ControllerWithCallbacks
- before_action :list, :only => :index
- before_action :authenticate, :except => :index
+ before_action :list, only: :index
+ before_action :authenticate, except: :index
def index
self.response_body = @list.join(", ")
@@ -126,14 +125,14 @@ module AbstractController
end
private
- def list
- @list = ["Hello", "World"]
- end
-
- def authenticate
- @list ||= []
- @authenticated = "true"
- end
+ def list
+ @list = ["Hello", "World"]
+ end
+
+ def authenticate
+ @list ||= []
+ @authenticated = "true"
+ end
end
class TestCallbacksWithConditions < ActiveSupport::TestCase
@@ -170,14 +169,14 @@ module AbstractController
end
private
- def list
- @list = ["Hello", "World"]
- end
-
- def authenticate
- @list = []
- @authenticated = "true"
- end
+ def list
+ @list = ["Hello", "World"]
+ end
+
+ def authenticate
+ @list = []
+ @authenticated = "true"
+ end
end
class TestCallbacksWithArrayConditions < ActiveSupport::TestCase
@@ -202,7 +201,7 @@ module AbstractController
end
class ChangedConditions < Callback2
- before_action :first, :only => :index
+ before_action :first, only: :index
def not_index
@text ||= nil
diff --git a/actionpack/test/abstract/collector_test.rb b/actionpack/test/abstract/collector_test.rb
index edbb84d462..7fe19e6b10 100644
--- a/actionpack/test/abstract/collector_test.rb
+++ b/actionpack/test/abstract/collector_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
module AbstractController
module Testing
diff --git a/actionpack/test/abstract/translation_test.rb b/actionpack/test/abstract/translation_test.rb
index 1435928578..1e17cb9777 100644
--- a/actionpack/test/abstract/translation_test.rb
+++ b/actionpack/test/abstract/translation_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
module AbstractController
module Testing
@@ -9,21 +9,19 @@ module AbstractController
class TranslationControllerTest < ActiveSupport::TestCase
def setup
@controller = TranslationController.new
- I18n.backend.store_translations(:en, {
- one: {
- two: 'bar',
+ I18n.backend.store_translations(:en, one: {
+ two: "bar",
},
abstract_controller: {
testing: {
translation: {
index: {
- foo: 'bar',
+ foo: "bar",
},
- no_action: 'no_action_tr',
+ no_action: "no_action_tr",
},
},
- },
- })
+ })
end
def test_action_controller_base_responds_to_translate
@@ -44,30 +42,30 @@ module AbstractController
def test_lazy_lookup
@controller.stub :action_name, :index do
- assert_equal 'bar', @controller.t('.foo')
+ assert_equal "bar", @controller.t(".foo")
end
end
def test_lazy_lookup_with_symbol
@controller.stub :action_name, :index do
- assert_equal 'bar', @controller.t(:'.foo')
+ assert_equal "bar", @controller.t(:'.foo')
end
end
def test_lazy_lookup_fallback
@controller.stub :action_name, :index do
- assert_equal 'no_action_tr', @controller.t(:'.no_action')
+ assert_equal "no_action_tr", @controller.t(:'.no_action')
end
end
def test_default_translation
@controller.stub :action_name, :index do
- assert_equal 'bar', @controller.t('one.two')
+ assert_equal "bar", @controller.t("one.two")
end
end
def test_localize
- time, expected = Time.gm(2000), 'Sat, 01 Jan 2000 00:00:00 +0000'
+ time, expected = Time.gm(2000), "Sat, 01 Jan 2000 00:00:00 +0000"
I18n.stub :localize, expected do
assert_equal expected, @controller.l(time)
end