Merge pull request #13 from edgecase/fix_27

Fix Ruby 2.7 behavior change
This commit is contained in:
Mike Doel
2020-02-28 09:09:58 -05:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@@ -126,11 +126,13 @@ class AboutMethods < Neo::Koan
assert_equal __("a secret"), my_private_method
end
def test_calling_private_methods_with_an_explicit_receiver
exception = assert_raise(___(NoMethodError)) do
self.my_private_method
if before_ruby_version("2.7") # https://github.com/edgecase/ruby_koans/issues/12
def test_calling_private_methods_with_an_explicit_receiver
exception = assert_raise(___(NoMethodError)) do
self.my_private_method
end
assert_match /#{__("method `my_private_method'")}/, exception.message
end
assert_match /#{__("method `my_private_method'")}/, exception.message
end
# ------------------------------------------------------------------

View File

@@ -25,6 +25,10 @@ def in_ruby_version(*versions)
yield if versions.any? { |v| ruby_version?(v) }
end
def before_ruby_version(version)
Gem::Version.new(RUBY_VERSION) < Gem::Version.new(version)
end
in_ruby_version("1.8") do
class KeyError < StandardError
end