Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions spec/ruby/core/hash/reject_spec.rb
Original file line number Diff line number Diff line change
@@ -25,15 +25,17 @@ def h.to_a() end
h.reject { false }.to_a.should == [[1, 2]]
end

ruby_bug "extra states should not be copied", "2.1" do
it "returns Hash instance for subclasses" do
HashSpecs::MyHash[1 => 2, 3 => 4].reject { false }.should be_kind_of(Hash)
HashSpecs::MyHash[1 => 2, 3 => 4].reject { true }.should be_kind_of(Hash)
end

it "taints the resulting hash" do
h = new_hash(:a => 1).taint
h.reject {false}.tainted?.should == false
ruby_version_is "2.2" do
context "with extra state" do
it "returns Hash instance for subclasses" do
HashSpecs::MyHash[1 => 2, 3 => 4].reject { false }.should be_kind_of(Hash)
HashSpecs::MyHash[1 => 2, 3 => 4].reject { true }.should be_kind_of(Hash)
end

it "does not taint the resulting hash" do
h = new_hash(:a => 1).taint
h.reject {false}.tainted?.should == false
end
end
end

0 comments on commit 0a256b2

Please sign in to comment.