diff options
Diffstat (limited to 'spec/ruby/core/kernel/methods_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/methods_spec.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/ruby/core/kernel/methods_spec.rb b/spec/ruby/core/kernel/methods_spec.rb index fb7a7e8be9..cfa22aa05a 100644 --- a/spec/ruby/core/kernel/methods_spec.rb +++ b/spec/ruby/core/kernel/methods_spec.rb @@ -5,67 +5,67 @@ require_relative '../../fixtures/reflection' # TODO: rewrite describe "Kernel#methods" do it "returns singleton methods defined by obj.meth" do - KernelSpecs::Methods.methods(false).should include(:ichi) + KernelSpecs::Methods.methods(false).should.include?(:ichi) end it "returns singleton methods defined in 'class << self'" do - KernelSpecs::Methods.methods(false).should include(:san) + KernelSpecs::Methods.methods(false).should.include?(:san) end it "returns private singleton methods defined by obj.meth" do - KernelSpecs::Methods.methods(false).should include(:shi) + KernelSpecs::Methods.methods(false).should.include?(:shi) end it "returns singleton methods defined in 'class << self' when it follows 'private'" do - KernelSpecs::Methods.methods(false).should include(:roku) + KernelSpecs::Methods.methods(false).should.include?(:roku) end it "does not return private singleton methods defined in 'class << self'" do - KernelSpecs::Methods.methods(false).should_not include(:shichi) + KernelSpecs::Methods.methods(false).should_not.include?(:shichi) end it "returns the publicly accessible methods of the object" do meths = KernelSpecs::Methods.methods(false) - meths.should include(:hachi, :ichi, :juu, :juu_ichi, - :juu_ni, :roku, :san, :shi) + meths.to_set.should >= Set[:hachi, :ichi, :juu, :juu_ichi, + :juu_ni, :roku, :san, :shi] KernelSpecs::Methods.new.methods(false).should == [] end it "returns the publicly accessible methods in the object, its ancestors and mixed-in modules" do meths = KernelSpecs::Methods.methods(false) & KernelSpecs::Methods.methods - meths.should include(:hachi, :ichi, :juu, :juu_ichi, - :juu_ni, :roku, :san, :shi) + meths.to_set.should >= Set[:hachi, :ichi, :juu, :juu_ichi, + :juu_ni, :roku, :san, :shi] - KernelSpecs::Methods.new.methods.should include(:ku, :ni, :juu_san) + KernelSpecs::Methods.new.methods.to_set.should >= Set[:ku, :ni, :juu_san] end it "returns methods added to the metaclass through extend" do meth = KernelSpecs::Methods.new - meth.methods.should_not include(:peekaboo) + meth.methods.should_not.include?(:peekaboo) meth.extend(KernelSpecs::Methods::MetaclassMethods) - meth.methods.should include(:peekaboo) + meth.methods.should.include?(:peekaboo) end it "does not return undefined singleton methods defined by obj.meth" do o = KernelSpecs::Child.new def o.single; end - o.methods.should include(:single) + o.methods.should.include?(:single) class << o; self; end.send :undef_method, :single - o.methods.should_not include(:single) + o.methods.should_not.include?(:single) end it "does not return superclass methods undefined in the object's class" do - KernelSpecs::Child.new.methods.should_not include(:parent_method) + KernelSpecs::Child.new.methods.should_not.include?(:parent_method) end it "does not return superclass methods undefined in a superclass" do - KernelSpecs::Grandchild.new.methods.should_not include(:parent_method) + KernelSpecs::Grandchild.new.methods.should_not.include?(:parent_method) end it "does not return included module methods undefined in the object's class" do - KernelSpecs::Grandchild.new.methods.should_not include(:parent_mixin_method) + KernelSpecs::Grandchild.new.methods.should_not.include?(:parent_mixin_method) end end |
