dimanche 20 décembre 2015

Factory Girl - wrong number of arguments (1 for 2..3)

I have a factories.rb file that looks like:

factory :link do
  employer
  sequence(:link) {|n| "testlink#{n}" }
  name  "Test Link"
  channel_cost 200
end


factory :matching do
  candidate
  job
  link              # ArgumentError: wrong number of arguments (1 for 2..3)

  after(:create) { |matching|
    job = matching.job
    job.employer = matching.employer
    job.save(validate: false)
  }
end

Note that employer, candidate, and job are all defined above this code. I'm getting an error at 'link' that doesn't make much sense to me.

What arguments does it want, and how do I add them?

Aucun commentaire:

Enregistrer un commentaire