summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/shared
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/kernel/shared')
-rw-r--r--spec/ruby/core/kernel/shared/method.rb8
-rw-r--r--spec/ruby/core/kernel/shared/require.rb8
2 files changed, 13 insertions, 3 deletions
diff --git a/spec/ruby/core/kernel/shared/method.rb b/spec/ruby/core/kernel/shared/method.rb
index 3418966b1b..8b6ab23fd3 100644
--- a/spec/ruby/core/kernel/shared/method.rb
+++ b/spec/ruby/core/kernel/shared/method.rb
@@ -15,12 +15,18 @@ describe :kernel_method, shared: true do
m.call.should == 'class done'
end
- it "returns a method object if we repond_to_missing? method" do
+ it "returns a method object if respond_to_missing?(method) is true" do
m = KernelSpecs::RespondViaMissing.new.send(@method, :handled_publicly)
m.should be_an_instance_of Method
m.call(42).should == "Done handled_publicly([42])"
end
+ it "the returned method object if respond_to_missing?(method) calls #method_missing with a Symbol name" do
+ m = KernelSpecs::RespondViaMissing.new.send(@method, "handled_publicly")
+ m.should be_an_instance_of Method
+ m.call(42).should == "Done handled_publicly([42])"
+ end
+
it "raises a NameError for an invalid method name" do
class KernelSpecs::Foo; def bar; 'done'; end; end
-> {
diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb
index d656b3b2f2..9a2c38be1a 100644
--- a/spec/ruby/core/kernel/shared/require.rb
+++ b/spec/ruby/core/kernel/shared/require.rb
@@ -546,8 +546,12 @@ describe :kernel_require, shared: true do
ScratchPad.recorded.should == []
end
- it "complex, enumerator, rational and thread are already required" do
- provided = %w[complex enumerator rational thread]
+ provided = %w[complex enumerator rational thread]
+ ruby_version_is "2.7" do
+ provided << 'ruby2_keywords'
+ end
+
+ it "#{provided.join(', ')} are already required" do
features = ruby_exe("puts $LOADED_FEATURES", options: '--disable-gems')
provided.each { |feature|
features.should =~ /\b#{feature}\.(rb|so|jar)$/