rspec / rspec-its

`its` for RSpec 3 extracted from rspec-core 2.x
MIT License
260 stars 39 forks source link

Wrong number of arguments #94

Open nirname opened 3 months ago

nirname commented 3 months ago

Rails 5.2

Using rspec-support 3.12.1
Using rspec-core 3.12.2
Using rspec-expectations 3.12.3
Using rspec-mocks 3.12.6
Using rspec 3.12.0
Using rspec-html-matchers 0.10.0
Using rspec-its 1.3.0
Using rspec-rails 4.0.1

When using [] for accessing hash-subject attributes

Failure/Error: its([:amount]) { is_expected.to eq(1)}

ArgumentError:
  wrong number of arguments (given 2, expected 3..5)

https://github.com/rspec/rspec-its/blob/main/lib/rspec/its.rb#L169

pirj commented 3 months ago

Can you please provide a bit more context about the spec you’re dealing with?

What if you set the breakpoint here, what seems off to you?

nirname commented 3 months ago

The part you mention works. It complains about this part https://github.com/rspec/rspec-its/blob/14297a74c9fb6e6501b0a5fb5e3a5b9e4e89bc41/lib/rspec/its.rb#L169 Although these 2 methods should be identical https://github.com/rspec/rspec-core/blob/1e661db5c5b431c0ee88a383e8e3767f02dccbfe/lib/rspec/core/example_group.rb#L158 and https://github.com/rspec/rspec-core/blob/1e661db5c5b431c0ee88a383e8e3767f02dccbfe/lib/rspec/core/example_group.rb#L161 vendoring the lib and replacing example with it helped Still not sure if it's compatibility problems

pirj commented 3 months ago

My apologies for being annoying. Let me repeat my questions.

Can you please provide a bit more context about the spec you’re dealing with?

What if you set the breakpoint here, what seems off to you?

nirname commented 2 months ago

@pirj Sorry for the long response, I'll try to reproduce this and provide more detailed description