trailblazer / rspec-cells

Spec your Cells.
http://cells.rubyforge.org
MIT License
62 stars 48 forks source link

rspec-cells 0.3.6 is broken with ruby <= 2.6 #96

Closed znz closed 3 years ago

znz commented 3 years ago

For example, expect(array).to be_all { some_block } is broken. Because it evaluates as array.all?({}) instead of array.all? { some_block }.

I think since https://github.com/trailblazer/rspec-cells/commit/aa3abc935402cef4f990d7ce4f7b00806e3d5d1e.

class C
  def foo(pattern=nil, &block)
    p [pattern, block_given?]
  end
end

class C1
  def method_missing(method, *args, &block)
    C.new.send(method, *args, &block)
  end
end

class C2
  def method_missing(method, *args, **kwargs, &block)
    C.new.send(method, *args, **kwargs, &block)
  end
end

C1.new.foo {}
C2.new.foo {}

With ruby <= 2.6:

[nil, true]
[{}, true]

With ruby >= 2.7:

[nil, true]
[nil, true]
yogeshjain999 commented 3 years ago

Thanks for reporting it @znz. We've released 0.3.7 with the fix 🍻