ruby on rails 3 - Problem with the factory girl cucumber step definitions -
I am using coconut step certainty given by the factory girl and I can not find anything to work here .
First of all, there are factories involved here:
factory. Diffin: user tax | You U.name {| N | "User # {n}"} u.first_name {| N | "First name # {n}"} u.last_name {| N | "Last name # {n}"} u.password 'please' u.password_confirmation 'please' finish the factory. Define: Do lecture | L L.name {| N | | "Lecture # {n}"} l.abreeze {| N | "Lec # {n}"} l.association: admin, factory :: user end I am trying to execute this step:
And the following lectures are present: | Name | Brief | | Information A - Algorithm and Datestructuron. Ainf | I am getting this error message and do not know exactly where it comes from:
user (# 42819220) expected, user found ( # 43753000) and the following lecture is present in ActiveRecord :: AssociationTypeMismatch / lecture / ui.feature: 11: and here are my model definitions: < Pre> class users & lt; ActiveRecord :: Base # Include modules to develop by default Other available are available: #: Tokens_Author, encryptable,: lockable, timeoutable and: ubiquitous schematic: database_modified, memorable, trackable # for your model attr_accessible Setup Accessible (or Protected) Features: Name, Password: Password_confirmation ,: remember_me ,: first_name ,: last_name validates_uniqueness_of: name has_many: administrated_lectures, class_name: "lecture", foreign_key: "admin_id", dependent :: final class definition Knowledge Cancel & lt; ActiveRecord :: Base validates_uniqueness_of: name validates_uniqueness_of: abbreviated name: ordered, command ("name") is_to: admin, class_name: "user" end I used it with spork btw I am doing. / P>
Kind regards,
Nils
This is the most Chance is due to Spark
The error is because the user is being reloaded at some point, but factorygill is still referring to the old stability of its The reason is that you can remove the constants like this: Object.remove_const: user view the row in this category:
-
You can see that this error is being reviewed with breakbinning or just somewhere around these 2 locations:
-
-
- (
My guess is that some ActiveRecord is reloading classes, but < Code> FactoryGirl is not reloading . There may be a way around that reset the FactoryGirl definitions: Spork.each_run do # This is not the right API, but there is something like: FactoryGirl.definition_file_paths = [File.join (Rails.root, 'spec', 'factories')] FactoryGirl.find_definitions end Hope that helps, Lance.
Comments
Post a Comment