aboutsummaryrefslogtreecommitdiffstats
path: root/spec/rubyspec/core/array/shared/delete_if.rb
blob: a9fb57e0d9ccfff122e99d39fd050288493db4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
describe :delete_if, shared: true do
  before :each do
    @object = [1,2,3]
  end

  ruby_version_is "2.3" do
    it "updates the receiver after all blocks" do
      @object.send(@method) do |e|
        @object.length.should == 3
        true
      end
      @object.length.should == 0
    end
  end

  ruby_version_is ""..."2.3" do
    it "updates the receiver after each true block" do
      count = 0
      @object.send(@method) do |e|
        @object.length.should == (3 - count)
        count += 1
        true
      end
      @object.length.should == 0
    end
  end
end