diff options
Diffstat (limited to 'spec/ruby/core/kernel/public_methods_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/public_methods_spec.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/spec/ruby/core/kernel/public_methods_spec.rb b/spec/ruby/core/kernel/public_methods_spec.rb index b72775483c..e334ac9a55 100644 --- a/spec/ruby/core/kernel/public_methods_spec.rb +++ b/spec/ruby/core/kernel/public_methods_spec.rb @@ -1,35 +1,34 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) -require File.expand_path('../../../fixtures/reflection', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' +require_relative '../../fixtures/reflection' # TODO: rewrite describe "Kernel#public_methods" do it "returns a list of the names of publicly accessible methods in the object" do - KernelSpecs::Methods.public_methods(false).sort.should include(:hachi, - :ichi, :juu, :juu_ni, :roku, :san, :shi) - KernelSpecs::Methods.new.public_methods(false).sort.should include(:juu_san, :ni) + KernelSpecs::Methods.public_methods(false).to_set.should >= Set[:hachi, :ichi, :juu, :juu_ni, :roku, :san, :shi] + KernelSpecs::Methods.new.public_methods(false).to_set.should >= Set[:juu_san, :ni] end it "returns a list of names without protected accessible methods in the object" do - KernelSpecs::Methods.public_methods(false).sort.should_not include(:juu_ichi) - KernelSpecs::Methods.new.public_methods(false).sort.should_not include(:ku) + KernelSpecs::Methods.public_methods(false).sort.should_not.include?(:juu_ichi) + KernelSpecs::Methods.new.public_methods(false).sort.should_not.include?(:ku) end it "returns a list of the names of publicly accessible methods in the object and its ancestors and mixed-in modules" do - (KernelSpecs::Methods.public_methods(false) & KernelSpecs::Methods.public_methods).sort.should include( - :hachi, :ichi, :juu, :juu_ni, :roku, :san, :shi) + (KernelSpecs::Methods.public_methods(false) & KernelSpecs::Methods.public_methods).to_set.should >= Set[ + :hachi, :ichi, :juu, :juu_ni, :roku, :san, :shi] m = KernelSpecs::Methods.new.public_methods - m.should include(:ni, :juu_san) + m.to_set.should >= Set[:ni, :juu_san] end it "returns methods mixed in to the metaclass" do m = KernelSpecs::Methods.new m.extend(KernelSpecs::Methods::MetaclassMethods) - m.public_methods.should include(:peekaboo) + m.public_methods.should.include?(:peekaboo) end it "returns public methods for immediates" do - 10.public_methods.should include(:divmod) + 10.public_methods.should.include?(:divmod) end end |
