Skip to content

Commit

Permalink
Enumerable#inject ignores the block when a symbol is given
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Nov 11, 2013
1 parent 2c80096 commit e4149ee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion opal/core/enumerable.rb
Expand Up @@ -587,7 +587,7 @@ def inject(object = undefined, sym = undefined, &block)
%x{
var result = object;
if (block !== nil) {
if (block !== nil && sym === undefined) {
self.$each._p = function() {
var value = #{Opal.destructure(`arguments`)};
Expand Down
6 changes: 0 additions & 6 deletions spec/filters/bugs/enumerable.rb
Expand Up @@ -11,9 +11,6 @@

fails "Enumerable#inject returns nil when fails(legacy rubycon)"
fails "Enumerable#inject without inject arguments(legacy rubycon)"
fails "Enumerable#inject can take a symbol argument"
fails "Enumerable#inject ignores the block if two arguments"
fails "Enumerable#inject can take two argument"

fails "Enumerable#max raises an ArgumentError for incomparable elements"
fails "Enumerable#max gathers whole arrays as elements when each yields multiple"
Expand All @@ -26,9 +23,6 @@

fails "Enumerable#reduce returns nil when fails(legacy rubycon)"
fails "Enumerable#reduce without inject arguments(legacy rubycon)"
fails "Enumerable#reduce can take a symbol argument"
fails "Enumerable#reduce ignores the block if two arguments"
fails "Enumerable#reduce can take two argument"

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

0 comments on commit e4149ee

Please sign in to comment.