Open mful opened 8 years ago
Found a workaround, though the underlying issue is still there. In my Factories, I replaced all instances of required true
and required false
with add_attribute :required, <value>
.
So an updated factory definition looks as follows:
# spec/factories/my_model_factories.rb
FactoryGirl.define do
factory :my_model do
# was 'required true'
add_attribute :required, true
end
end
I'm not really up in the ruby code at the moment and haven't had a chance to look at this yet - do you have any suggestions/proposals to fix this? I'm sure we'll get to this eventually but obviously suggestions (or, heh, best case pull requests I suppose) would help accelerate that timeline ;-)
I've got a PR that should fix this without modifying any generated code.
As noted in the PR, the scope of this bug isn't just compatibility with FactoryBot. The required
method is introduced globally and will conflict with any codebase that has a method named required
.
Hi there,
Trying to integrate the asana API client into a project I am working on. Simply adding the gem to my Gemfile and bundling breaks my test suite, because I have factories that create models with a
required
attribute, and the the#required
method inruby-asana/lib/asana/ruby2_0_0_compatibility.rb
interferes.Stack Trace (note line 4):
To quickly reproduce, create a model with a boolean
required
attribute in a rails project that usesFactoryGirl
, and create a simple Factory for it, then try to runrspec
:Is there a way I can work around this?
Thanks!
┆Issue is synchronized with this Asana task