summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/shared/kind_of.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/kernel/shared/kind_of.rb')
-rw-r--r--spec/ruby/core/kernel/shared/kind_of.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/ruby/core/kernel/shared/kind_of.rb b/spec/ruby/core/kernel/shared/kind_of.rb
index 690018d655..a5e0eab08f 100644
--- a/spec/ruby/core/kernel/shared/kind_of.rb
+++ b/spec/ruby/core/kernel/shared/kind_of.rb
@@ -31,14 +31,25 @@ describe :kernel_kind_of, shared: true do
@o.send(@method, KernelSpecs::MyExtensionModule).should == true
end
- it "returns false if given a Module not included in object's class nor ancestors" do
+ it "returns true if given a Module that object has been prepended with" do
+ @o.send(@method, KernelSpecs::MyPrependedModule).should == true
+ end
+
+ it "returns false if given a Module not included nor prepended in object's class nor ancestors" do
@o.send(@method, KernelSpecs::SomeOtherModule).should == false
end
it "raises a TypeError if given an object that is not a Class nor a Module" do
- lambda { @o.send(@method, 1) }.should raise_error(TypeError)
- lambda { @o.send(@method, 'KindaClass') }.should raise_error(TypeError)
- lambda { @o.send(@method, :KindaClass) }.should raise_error(TypeError)
- lambda { @o.send(@method, Object.new) }.should raise_error(TypeError)
+ -> { @o.send(@method, 1) }.should.raise(TypeError)
+ -> { @o.send(@method, 'KindaClass') }.should.raise(TypeError)
+ -> { @o.send(@method, :KindaClass) }.should.raise(TypeError)
+ -> { @o.send(@method, Object.new) }.should.raise(TypeError)
+ end
+
+ it "does not take into account `class` method overriding" do
+ def @o.class; Integer; end
+
+ @o.send(@method, Integer).should == false
+ @o.send(@method, KernelSpecs::KindaClass).should == true
end
end