factory-bot Questions

1

Solved

I have these models that I'm trying to create factories for using factory_girl. class Foo < ActiveRecord::Base belongs_to :baz end class Baz < ActiveRecord::Base has_many :foos end I'm ...
Patristic asked 6/7, 2011 at 17:49

3

Solved

I'm working with factory_girl, but looking at the machinist gem. Could you tell me please - what are the pros and cons of migrating to machinist? Have you compared those libs?
Jessalyn asked 25/1, 2010 at 9:46

4

Solved

i will use RSpec with Factory girl in my Rails3 Project. I have installed factory girl but it don't find the factorys i have this error Failure/Error: Factory.build(:user).should_be valid No such ...
Stonework asked 29/11, 2010 at 11:35

2

Solved

I'm fairly new to rails and TDD (as will no doubt be obvious from my post) and am having a hard time wrapping my brain around Rspec and FactoryGirl. I'm using Rails 3, rspec and factory girl: ge...
Kaleidoscope asked 9/2, 2011 at 19:7

3

Maybe this isn't something that needs to be tested against, but I'm learning so I don't think its wrong to test to the max. I have several tests that all produce the expected results except for on...
Triarchy asked 5/5, 2011 at 3:1

1

Solved

How do you debug factory_girl? i've tried to put debugger in there but i just cant. I just want to test why my associations aren't working right
Westernism asked 11/4, 2011 at 6:35

3

The Factory Girl docs offer this syntax for creating (I guess) parent-child associations... Factory.define :post do |p| p.author {|a| a.association(:user) } end A post belongs to a User (its ...
Sg asked 26/6, 2009 at 6:41

3

Solved

What's the purpose of Factory Girl in rspec tests when I could use before(:each) blocks? It feels like the only difference between Factory Girl and a before(:each) is that the factory prepares obje...
Frunze asked 3/3, 2011 at 17:4

3

Solved

Situation # Models class User < ActiveRecord::Base has_many :items end class Items < ActiveRecord::Base belongs_to :user validates_presence_of :user_id end # Factories Factory.defi...
Pasteurism asked 1/10, 2009 at 21:17

2

Solved

I am using Cucumber, RSpec, and Factory Girl for the testing of my Rails application. But I have several lookup tables that contain mostly static data. So I'm trying to figure out the best way to p...
Shannonshanny asked 22/1, 2011 at 0:24

2

Solved

Seems like I should have been able to find an obvious answer to this problem after a few hours of Googling and testing. I want to be able to set caredate.user_id => provider.user_id within the ca...
Erector asked 10/12, 2010 at 16:13

3

Solved

I'm new to cucumber and I find following snippets to test the Devise login feature. However it seems one more step missing, and I didn't find any solution: Given /^that a confirmed user exists$/ d...
Progenitive asked 2/11, 2010 at 23:31

3

Solved

Many programmers use devise as their authentication solution and I would like to get their advice: Devise is already tested, but I want to know if there is something to test by myself (integratio...
Vicinage asked 26/10, 2010 at 14:49

1

Solved

I have 2 Models: # user.rb class User < ActiveRecord::Base has_one :profile, :dependent => :destroy end # profile.rb class Profile < ActiveRecord::Base belongs_to :user validates_pres...

1

Solved

I have this kind of relation: class Article < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :article attr_protected :article_id end The defaul...

1

Solved

I have a constraint and a validation placed on the guid field so that each is unique. The problem is, with the factory definition that I have below, I can create only one user instance, as addition...
Lennielenno asked 14/7, 2010 at 13:19

1

Solved

I am trying to simulate a session using FactoryGirl/shoulda (it worked with fixtures but i am having problems with using factories). I have following factories (user login and email both have uniqu...
Hedgerow asked 23/4, 2010 at 9:8

2

Solved

I'm just getting into Factory Girl and I am running into a difficulty that I'm sure should be much easier. I just couldn't twist the documentation into a working example. Assume I have the followi...
Burgas asked 2/3, 2010 at 19:59

1

Solved

I recently noticed my test database is not being cleaned up after my tests run if my tests subclass Test::Unit::TestCase. If my tests subclass ActiveSupport::TestCase, everything is cleaned up prop...
Mady asked 18/1, 2010 at 7:44

3

Solved

How do I write tests for projects which use establish_connection in model to connect to another database?

© 2022 - 2024 — McMap. All rights reserved.