Skip to content

Commit

Permalink
Enable some previosuly filtered enumerable specs
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 27, 2013
1 parent 8b972a9 commit 9dbae29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
4 changes: 4 additions & 0 deletions corelib/enumerable.rb
Expand Up @@ -151,6 +151,8 @@ def count(object = undefined, &block)
end

def detect(ifnone = undefined, &block)
return enum_for :detect, ifnone unless block_given?

%x{
var result = undefined;
Expand Down Expand Up @@ -350,6 +352,8 @@ def entries
alias find detect

def find_all(&block)
return enum_for :find_all unless block_given?

%x{
var result = [];
Expand Down
23 changes: 0 additions & 23 deletions spec/filters/bugs/enumerable.rb
@@ -1,19 +1,9 @@
opal_filter "Enumerable" do
fails "Enumerable#detect passes the ifnone proc to the enumerator"
fails "Enumerable#detect returns an enumerator when no block given"
fails "Enumerable#detect passes through the values yielded by #each_with_index"

fails "Enumerable#drop passed a number n as an argument tries to convert n to an Integer using #to_int"
fails "Enumerable#drop passed a number n as an argument raises a TypeError when the passed n can be coerced to Integer"

fails "Enumerable#drop_while passes elements to the block until the first false"
fails "Enumerable#drop_while will only go through what's needed"
fails "Enumerable#drop_while gathers whole arrays as elements when each yields multiple"

fails "Enumerable#each_slice tries to convert n to an Integer using #to_int"
fails "Enumerable#each_slice raises an Argument Error if there is not a single parameter > 0"
fails "Enumerable#each_slice yields only as much as needed"
fails "Enumerable#each_slice gathers whole arrays as elements when each yields multiple"

fails "Enumerable#each_with_index provides each element to the block"
fails "Enumerable#each_with_index provides each element to the block and its index"
Expand All @@ -22,15 +12,6 @@

fails "Enumerable#entries passes arguments to each"

fails "Enumerable#find passes through the values yielded by #each_with_index"
fails "Enumerable#find returns an enumerator when no block given"
fails "Enumerable#find passes the ifnone proc to the enumerator"

fails "Enumerable#find_all returns an enumerator when no block given"
fails "Enumerable#find_all passes through the values yielded by #each_with_index"

fails "Enumerable#find_index gathers initial args as elements when each yields multiple"

fails "Enumerable#first when passed an argument consumes only what is needed"
fails "Enumerable#first when passed an argument raises a TypeError if the passed argument is not numeric"
fails "Enumerable#first when passed an argument tries to convert the passed argument to an Integer using #to_int"
Expand All @@ -46,8 +27,6 @@

fails "Enumerable#inject returns nil when fails(legacy rubycon)"
fails "Enumerable#inject without inject arguments(legacy rubycon)"
fails "Enumerable#inject gathers whole arrays as elements when each yields multiple"
fails "Enumerable#inject without argument takes a block with an accumulator (with first element as initial value) and the current element. Value of block becomes new accumulator"
fails "Enumerable#inject can take a symbol argument"
fails "Enumerable#inject ignores the block if two arguments"
fails "Enumerable#inject can take two argument"
Expand All @@ -63,8 +42,6 @@

fails "Enumerable#reduce returns nil when fails(legacy rubycon)"
fails "Enumerable#reduce without inject arguments(legacy rubycon)"
fails "Enumerable#reduce gathers whole arrays as elements when each yields multiple"
fails "Enumerable#reduce without argument takes a block with an accumulator (with first element as initial value) and the current element. Value of block becomes new accumulator"
fails "Enumerable#reduce can take a symbol argument"
fails "Enumerable#reduce ignores the block if two arguments"
fails "Enumerable#reduce can take two argument"
Expand Down

0 comments on commit 9dbae29

Please sign in to comment.