mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
<=> 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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user