mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-13 06:43:20 -04:00
Merge pull request #13 from edgecase/fix_27
Fix Ruby 2.7 behavior change
This commit is contained in:
@@ -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
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user