diff options
Diffstat (limited to 'activesupport/test/test_case_test.rb')
-rw-r--r-- | activesupport/test/test_case_test.rb | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 772c3cfca7..d3d2ed8d7a 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class AssertDifferenceTest < ActiveSupport::TestCase def setup @@ -20,21 +20,21 @@ class AssertDifferenceTest < ActiveSupport::TestCase assert_equal true, assert_not(false) e = assert_raises(Minitest::Assertion) { assert_not true } - assert_equal 'Expected true to be nil or false', e.message + assert_equal "Expected true to be nil or false", e.message - e = assert_raises(Minitest::Assertion) { assert_not true, 'custom' } - assert_equal 'custom', e.message + e = assert_raises(Minitest::Assertion) { assert_not true, "custom" } + assert_equal "custom", e.message end def test_assert_no_difference_pass - assert_no_difference '@object.num' do + assert_no_difference "@object.num" do # ... end end def test_assert_no_difference_fail error = assert_raises(Minitest::Assertion) do - assert_no_difference '@object.num' do + assert_no_difference "@object.num" do @object.increment end end @@ -43,7 +43,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_assert_no_difference_with_message_fail error = assert_raises(Minitest::Assertion) do - assert_no_difference '@object.num', 'Object Changed' do + assert_no_difference "@object.num", "Object Changed" do @object.increment end end @@ -51,13 +51,13 @@ class AssertDifferenceTest < ActiveSupport::TestCase end def test_assert_difference - assert_difference '@object.num', +1 do + assert_difference "@object.num", +1 do @object.increment end end def test_assert_difference_retval - incremented = assert_difference '@object.num', +1 do + incremented = assert_difference "@object.num", +1 do @object.increment end @@ -65,40 +65,40 @@ class AssertDifferenceTest < ActiveSupport::TestCase end def test_assert_difference_with_implicit_difference - assert_difference '@object.num' do + assert_difference "@object.num" do @object.increment end end def test_arbitrary_expression - assert_difference '@object.num + 1', +2 do + assert_difference "@object.num + 1", +2 do @object.increment @object.increment end end def test_negative_differences - assert_difference '@object.num', -1 do + assert_difference "@object.num", -1 do @object.decrement end end def test_expression_is_evaluated_in_the_appropriate_scope silence_warnings do - local_scope = local_scope = 'foo' - assert_difference('local_scope; @object.num') { @object.increment } + local_scope = local_scope = "foo" + assert_difference("local_scope; @object.num") { @object.increment } end end def test_array_of_expressions - assert_difference [ '@object.num', '@object.num + 1' ], +1 do + assert_difference [ "@object.num", "@object.num + 1" ], +1 do @object.increment end end def test_array_of_expressions_identify_failure assert_raises(Minitest::Assertion) do - assert_difference ['@object.num', '1 + 1'] do + assert_difference ["@object.num", "1 + 1"] do @object.increment end end @@ -106,14 +106,14 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_array_of_expressions_identify_failure_when_message_provided assert_raises(Minitest::Assertion) do - assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do + assert_difference ["@object.num", "1 + 1"], 1, "something went wrong" do @object.increment end end end def test_assert_changes_pass - assert_changes '@object.num' do + assert_changes "@object.num" do @object.increment end end @@ -125,42 +125,42 @@ class AssertDifferenceTest < ActiveSupport::TestCase end def test_assert_changes_with_from_option - assert_changes '@object.num', from: 0 do + assert_changes "@object.num", from: 0 do @object.increment end end def test_assert_changes_with_from_option_with_wrong_value assert_raises Minitest::Assertion do - assert_changes '@object.num', from: -1 do + assert_changes "@object.num", from: -1 do @object.increment end end end def test_assert_changes_with_to_option - assert_changes '@object.num', to: 1 do + assert_changes "@object.num", to: 1 do @object.increment end end def test_assert_changes_with_wrong_to_option assert_raises Minitest::Assertion do - assert_changes '@object.num', to: 2 do + assert_changes "@object.num", to: 2 do @object.increment end end end def test_assert_changes_with_from_option_and_to_option - assert_changes '@object.num', from: 0, to: 1 do + assert_changes "@object.num", from: 0, to: 1 do @object.increment end end def test_assert_changes_with_from_and_to_options_and_wrong_to_value assert_raises Minitest::Assertion do - assert_changes '@object.num', from: 0, to: 2 do + assert_changes "@object.num", from: 0, to: 2 do @object.increment end end @@ -189,7 +189,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_assert_changes_with_to_and_case_operator token = nil - assert_changes 'token', to: /\w{32}/ do + assert_changes "token", to: /\w{32}/ do token = SecureRandom.hex end end @@ -197,20 +197,20 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_assert_changes_with_to_and_from_and_case_operator token = SecureRandom.hex - assert_changes 'token', from: /\w{32}/, to: /\w{32}/ do + assert_changes "token", from: /\w{32}/, to: /\w{32}/ do token = SecureRandom.hex end end def test_assert_no_changes_pass - assert_no_changes '@object.num' do + assert_no_changes "@object.num" do # ... end end def test_assert_no_changes_with_message error = assert_raises Minitest::Assertion do - assert_no_changes '@object.num', '@object.num should not change' do + assert_no_changes "@object.num", "@object.num should not change" do @object.increment end end @@ -276,7 +276,7 @@ end class TestCaseTaggedLoggingTest < ActiveSupport::TestCase def before_setup - require 'stringio' + require "stringio" @out = StringIO.new self.tagged_logger = ActiveSupport::TaggedLogging.new(Logger.new(@out)) super |