summaryrefslogtreecommitdiff
path: root/spec/ruby/core/hash/compact_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/hash/compact_spec.rb')
-rw-r--r--spec/ruby/core/hash/compact_spec.rb46
1 files changed, 22 insertions, 24 deletions
diff --git a/spec/ruby/core/hash/compact_spec.rb b/spec/ruby/core/hash/compact_spec.rb
index 76aa43949d..de83dabed3 100644
--- a/spec/ruby/core/hash/compact_spec.rb
+++ b/spec/ruby/core/hash/compact_spec.rb
@@ -10,7 +10,7 @@ describe "Hash#compact" do
it "returns new object that rejects pair has nil value" do
ret = @hash.compact
- ret.should_not equal(@hash)
+ ret.should_not.equal?(@hash)
ret.should == @compact
end
@@ -19,28 +19,26 @@ describe "Hash#compact" do
@hash.should == @initial_pairs
end
- ruby_version_is '3.3' do
- it "retains the default value" do
- hash = Hash.new(1)
- hash.compact.default.should == 1
- hash[:a] = 1
- hash.compact.default.should == 1
- end
+ it "retains the default value" do
+ hash = Hash.new(1)
+ hash.compact.default.should == 1
+ hash[:a] = 1
+ hash.compact.default.should == 1
+ end
- it "retains the default_proc" do
- pr = proc { |h, k| h[k] = [] }
- hash = Hash.new(&pr)
- hash.compact.default_proc.should == pr
- hash[:a] = 1
- hash.compact.default_proc.should == pr
- end
+ it "retains the default_proc" do
+ pr = proc { |h, k| h[k] = [] }
+ hash = Hash.new(&pr)
+ hash.compact.default_proc.should == pr
+ hash[:a] = 1
+ hash.compact.default_proc.should == pr
+ end
- it "retains compare_by_identity_flag" do
- hash = {}.compare_by_identity
- hash.compact.compare_by_identity?.should == true
- hash[:a] = 1
- hash.compact.compare_by_identity?.should == true
- end
+ it "retains compare_by_identity flag" do
+ hash = {}.compare_by_identity
+ hash.compact.compare_by_identity?.should == true
+ hash[:a] = 1
+ hash.compact.compare_by_identity?.should == true
end
end
@@ -52,7 +50,7 @@ describe "Hash#compact!" do
end
it "returns self" do
- @hash.compact!.should equal(@hash)
+ @hash.compact!.should.equal?(@hash)
end
it "rejects own pair has nil value" do
@@ -66,7 +64,7 @@ describe "Hash#compact!" do
end
it "returns nil" do
- @hash.compact!.should be_nil
+ @hash.compact!.should == nil
end
end
@@ -76,7 +74,7 @@ describe "Hash#compact!" do
end
it "keeps pairs and raises a FrozenError" do
- ->{ @hash.compact! }.should raise_error(FrozenError)
+ ->{ @hash.compact! }.should.raise(FrozenError)
@hash.should == @initial_pairs
end
end