djezzzl / factory_trace

Simple tool to maintain factories and traits from FactoryBot
MIT License
381 stars 7 forks source link

Doesn't appear to support build/build_list #38

Closed aliuk2012 closed 1 year ago

aliuk2012 commented 1 year ago

If I run my specs using rspec they all pass but if it use FB_TRACE=1 rspec I get loads of failures mostly relating to tests that use build or build_list.

Example of output:

 Failure/Error: let(:current_user) { build(:user) }

       ArgumentError:
         wrong number of arguments (given 1, expected 2)
szymonlipka commented 1 year ago

Same here. With config.trace_definition = false it is working. Trace of the error is:

Exception: ArgumentError: wrong number of arguments (given 1, expected 2)
--
0: .../gems/factory_trace-1.1.0/lib/factory_trace/monkey_patches/trait.rb:8:in `initialize'
1: .../gems/factory_bot-6.2.1/lib/factory_bot/enum.rb:22:in `new'
2: .../gems/factory_bot-6.2.1/lib/factory_bot/enum.rb:22:in `build_trait'
3: .../gems/factory_bot-6.2.1/lib/factory_bot/enum.rb:11:in `block in build_traits'
4: .../gems/factory_bot-6.2.1/lib/factory_bot/enum.rb:10:in `each'
djezzzl commented 1 year ago

Hi @szymonlipka @aliuk2012, thank you for opening the issue!

Could you please share your factory_bot version?

I'll try to reproduce it and fix it ASAP.

szymonlipka commented 1 year ago

Actually the version is in the trace I've posted - 6.2.1. I could look into that later if you need help

djezzzl commented 1 year ago

Sorry, I overlooked that. Thank you! I will investigate it ASAP.

djezzzl commented 1 year ago

Hi there!

I just merged the fix https://github.com/djezzzl/factory_trace/pull/39.

And released it as 1.1.1. Please try it out and let me know if it worked well.

Meanwhile, I'm closing the issue but feel free to reopen it if you need to.

Thank you for using the gem!