factory-bot
Declare :child_key for has_many associations in factory_girl (datamapper)
I use datamapper and postgres for my ror application, in my models i have such associations: #/models/account.rb[详细]
2023-03-17 16:46 分类:问答Factory Girl: How do you make a factory that isn't tied to a model?
I just need a hash of attributes for things like credit card, and address. Example: Factory.define :credit_card, :class => Object do |c|[详细]
2023-03-16 10:33 分类:问答RSpec Model Validation failing but works fine in Rails Console?
I have been really stuck on this problem. My validation for my model fails (like it should) when I\'m testing it out in rails console, but my rspec example fails because it validates anyway (which it[详细]
2023-03-15 02:27 分类:问答How to define factories for a has_many through association
I am new to testing and factory_girl, and I want to create factories using factory_girl for a has_many through association.[详细]
2023-03-14 09:40 分类:问答Using factory_girl_rails with Rspec on namespaced models
I have a web service that serves Ads to several different clients. The structure of the Ad varies between clients, and therefore, I am using namespaces for my models and contro开发者_高级运维llers by[详细]
2023-03-13 11:38 分类:问答How to use `assigns` with Factory Girl
Hiho, I have the following test: test \"should annoy Chuck Norris\" do son = Factory.build(:son) assert_difference(\'Son.count\') do[详细]
2023-03-13 01:52 分类:问答Railstutorial: db:populate vs. factory girl
In the railstutorial, why does the author choose to use this (Listing 10.25): http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users[详细]
2023-03-12 21:04 分类:问答How can I have faster tests and still use Factory Girl?
I really like using Factory Girl to setup my tests. I can build chains of associations in a single line. For example:[详细]
2023-03-11 19:52 分类:问答Factory won't set password and password_confirmation
My User.rb has: attr_accessor :password, :password_confirmation attr_accessible :password, :password_confirmation[详细]
2023-03-11 18:44 分类:问答How do I create a factory for models that have a has_one/belongs_to relationship with validations that are usually overcome by nested attributes?
I have an Account model that has_one User model, and a User model that belongs_to Account model. I think that the basic code required for demonstration is:[详细]
2023-03-10 12:04 分类:问答