Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrading from 4.7.0 to 4.8.0 breaks symbol to proc callbacks #980

Closed
ghost opened this issue Jan 6, 2017 · 2 comments
Closed

upgrading from 4.7.0 to 4.8.0 breaks symbol to proc callbacks #980

ghost opened this issue Jan 6, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 6, 2017

This factory works as expected on 4.7.0

FactoryGirl.define do
  factory :unconfirmed_user, class: 'User' do
    email                 { Faker::Internet.email }
    password              { Faker::Internet.password }
    password_confirmation { password }

    factory :user, aliases: %i[ confirmed_user ] do
      after :create, &:confirm
    end
  end
end

but causes the following output after upgrading to 4.8.0:

 NoMethodError:
       undefined method `confirm' for #<FactoryGirl::SyntaxRunner:0x007feab1f28700>
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/callback.rb:13:in `instance_exec'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/callback.rb:13:in `run'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/callbacks_observer.rb:11:in `block in update'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/callbacks_observer.rb:10:in `each'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/callbacks_observer.rb:10:in `update'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:20:in `notify'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:13:in `block in result'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `tap'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
     # /Users/bm5k/.rvm/gems/ruby-2.4.0@disproxary/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
@fujimura
Copy link

fujimura commented Jan 9, 2017

There's a bug in instance_exec with symbol.to_proc in Ruby 2.4.0.

Bug #13074: When executing instance_exec with symbol.to_proc, it ignores first argument.

@ghost
Copy link
Author

ghost commented Jan 9, 2017

Confirmed that this is not a problem with factory girl ~> 4.8.0 + ruby 2.3.3.

@fujimura thanks for pointing this out

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant