Use alt example in about_open_classes

Integer#even? ended up in a more modern version of ruby (yay progress!). This updates the koan to use a different, more outlandish example, that I don’t think will end up in Ruby — and that I know Jim would appreciate <3
This commit is contained in:
Tony Schneider
2022-02-13 14:54:14 +00:00
parent 250aaa44ab
commit 561965bb6a

View File

@@ -30,14 +30,14 @@ class AboutOpenClasses < Neo::Koan
# ------------------------------------------------------------------
class ::Integer
def even?
(self % 2) == 0
def answer_to_life_universe_and_everything?
self == 42
end
end
def test_even_existing_built_in_classes_can_be_reopened
assert_equal __(false), 1.even?
assert_equal __(true), 2.even?
assert_equal __(false), 1.answer_to_life_universe_and_everything?
assert_equal __(true), 42.answer_to_life_universe_and_everything?
end
# NOTE: To understand why we need the :: before Integer, you need to