aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/array/filter_spec.rb
blob: a26966270901fdd6a484369b18c1dcf249ee624f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/select', __FILE__)

ruby_version_is "2.6" do
  describe "Array#filter" do
    it_behaves_like :array_select, :filter
  end

  describe "Array#filter!" do
    it "returns nil if no changes were made in the array" do
      [1, 2, 3].filter! { true }.should be_nil
    end

    it_behaves_like :keep_if, :filter!
  end
end