factory-bot
RSpec's failing because it thinks ActiveRecord objects aren't equal
Very simple spec... @post.user.should == @user Spec fails even though both objects are identical in every way except their object_id. ActiveRecord objects should equal (==) if their id\'s are the s[详细]
2023-04-05 18:53 分类:问答Ruby on Rails allow mass assignment for an RSpec test
I\'m testing my Rails application with RSpec, but then I ran into a problem. I want a consistent database, therefore I imposed a constraint that some columns can not be null.[详细]
2023-04-05 18:36 分类:问答Trouble on rspecting a FactoryGirl object
I am using Ruby on Rails 3.0.10, RSpec 2 and FactoryGirl. I have the following scenario: In the models/user_spec.rb file I have[详细]
2023-04-05 15:23 分类:问答How to generate multiple asscoated records for the same parent record in factory_girl?
Here is the definition for model user and user_level. A user has many user levels and a user level belongs to a user.[详细]
2023-04-05 09:59 分类:问答Model passes validation of :presence => true and still nil in database
user_type is a column in user model and it has to be :presence => true. It rejects in rspec when passing a nil to use开发者_Go百科r_type. However the factory_girl can store a nil user_type into the fi[详细]
2023-04-04 12:20 分类:问答Factory_girl and Factory_girl_rails conflict error
The following is the error message running rspec spec: /factory_girl-2.1.0/lib/factory_girl/registry.rb:38:in `add_as\': Already defined: user (FactoryGirl::DuplicateDefinitionError)[详细]
2023-04-04 04:45 分类:问答Error in Factory_girl: NoMethodError: undefined method - rspec and rails 3.1.0
I am having a problem with factory_girl. Here is the error with rspec. \"Failure/Error: customer = Factory(:customer, :name => nil)[详细]
2023-04-04 04:03 分类:问答How to make has_many :through association with fixtures?
I can\'t use factory_girl because I\'m testing sunspot and need real database. Edit: nope. It can works with sunspot. I\'m wrong.[详细]
2023-04-04 02:35 分类:问答How does the many-to-many association work in FactoryGirl? [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to make has_many :through association with fixtures?[详细]
2023-04-03 19:57 分类:问答Cucumber: Factory Girl doesn't modify database -- creates object with .create but database table is still empty afterwards
p = Factory(:model) ap Model.find(:all)#output to prove that it\'s getting created so... the print shows that the IDs of the objects is going up.... but the database remains empty as I continually[详细]
2023-04-03 09:57 分类:问答