diff options
author | Go MAEDA <maeda@farend.jp> | 2023-06-29 14:42:54 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-06-29 14:42:54 +0000 |
commit | 945a82b5c0aad6bd6af656865015277d3e0e612b (patch) | |
tree | d6bf1c4e7fdf2bb5d32b55ae7e5c0477b31377c9 /test | |
parent | ebf3fb3b4fa53f3bc6f9cbbcd529c6b296d4f6fc (diff) | |
download | redmine-945a82b5c0aad6bd6af656865015277d3e0e612b.tar.gz redmine-945a82b5c0aad6bd6af656865015277d3e0e612b.zip |
<=> operator should return nil when invoked with an incomparable object (#38772).
Patch by Go MAEDA.
git-svn-id: https://svn.redmine.org/redmine/trunk@22269 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/enumeration_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index 25dfb14c4..a9d0e8eb3 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.rb @@ -179,4 +179,10 @@ class EnumerationTest < ActiveSupport::TestCase override.destroy assert_equal [1, 2, 3], [a, b, c].map(&:reload).map(&:position) end + + def test_spaceship_operator_with_incomparable_value_should_return_nil + e = Enumeration.first + assert_nil e <=> nil + assert_nil e <=> 'foo' + end end |