1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/core/hash/empty_spec.rb
2020-05-03 12:28:29 +02:00

15 lines
409 B
Ruby

require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Hash#empty?" do
it "returns true if the hash has no entries" do
{}.should.empty?
{ 1 => 1 }.should_not.empty?
end
it "returns true if the hash has no entries and has a default value" do
Hash.new(5).should.empty?
Hash.new { 5 }.should.empty?
Hash.new { |hsh, k| hsh[k] = k }.should.empty?
end
end