-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
56 changed files
with
438 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
require File.expand_path('../../shared/enumeratorize', __FILE__) | ||
require File.expand_path('../../shared/keep_if', __FILE__) | ||
require File.expand_path('../../../enumerable/shared/enumeratorized', __FILE__) | ||
|
||
describe :array_select, shared: true do | ||
it_should_behave_like :enumeratorize | ||
|
||
before :each do | ||
@object = [1,2,3] | ||
end | ||
it_should_behave_like :enumeratorized_with_origin_size | ||
|
||
it "returns a new array of elements for which block is true" do | ||
[1, 3, 4, 5, 6, 9].send(@method) { |i| i % ((i + 1) / 2) == 0}.should == [1, 4, 6] | ||
end | ||
|
||
it "does not return subclass instance on Array subclasses" do | ||
ArraySpecs::MyArray[1, 2, 3].send(@method) { true }.should be_an_instance_of(Array) | ||
end | ||
|
||
it "properly handles recursive arrays" do | ||
empty = ArraySpecs.empty_recursive_array | ||
empty.send(@method) { true }.should == empty | ||
empty.send(@method) { false }.should == [] | ||
|
||
array = ArraySpecs.recursive_array | ||
array.send(@method) { true }.should == [1, 'two', 3.0, array, array, array, array, array] | ||
array.send(@method) { false }.should == [] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require File.expand_path('../fixtures/classes', __FILE__) | ||
require File.expand_path('../shared/find_all', __FILE__) | ||
|
||
ruby_version_is "2.6" do | ||
describe "Enumerable#filter" do | ||
it_behaves_like(:enumerable_find_all , :filter) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require File.expand_path('../shared/select', __FILE__) | ||
|
||
ruby_version_is "2.6" do | ||
describe "Hash#filter" do | ||
it_behaves_like :hash_select, :filter | ||
end | ||
|
||
describe "Hash#filter!" do | ||
it_behaves_like :hash_select!, :filter! | ||
end | ||
end |
Oops, something went wrong.