factory-bot Questions
0
How to do composite keys using FactoryGirl with below relationship
Portal(uuid, name)
listing(uuid, portal_uuid, name)
location(uuid, portal_uuid)
in here listing and location has composite pri...
Tartu asked 29/3, 2012 at 9:1
3
Solved
I've inherited an old Rails2.3 app. It's very complex and has (shock, horror) no tests whatsoever. I'm used to rspec and cucumber so I thought I'd start working on getting specs and features define...
Ascendancy asked 2/6, 2011 at 13:58
5
Solved
I need to pass extra arguments to factory girl to be used in a callback. Something like this (but more complex really):
Factory.define :blog do |blog|
blog.name "Blah"
blog.after_create do |blo...
Piccaninny asked 19/4, 2010 at 9:56
4
Solved
Just getting started with factory girl, and I've come across a problem with sequencing: Specifically, it doesn't increment. I've tried changing the database type, updating from factory_girl 1.3.2 t...
Ablebodied asked 20/12, 2010 at 19:15
1
Solved
I'm trying to reset the "sequence" in factory girl between each test I run.
(factory_girl 2.6.0 and factory_girl_rails 1.7.0)
I think that to do so, I have to reload the FactoryGirl definitions. ...
Bordeaux asked 26/2, 2012 at 16:10
3
Solved
Is there a simple way in factory girl to create a new factory only if one doesn't already exist?
If there isn't a simple way, what's the most concise means to ensure only one factory is created f...
Obsequent asked 6/1, 2011 at 7:58
2
Solved
I have models: Post and User(Devise). I am testing controller Post.
describe "If user sign_in" do
before(:all){
@user = Factory(:user)
}
it "should get new" do
sign_in @user
get 'new'
r...
Frieda asked 12/2, 2012 at 12:0
2
Solved
When I call Factory.attributes_for(:some_class) I obviously get back a hash of attributes for that class.
{ :attribute_one => "hello", :attribute_two => "goodbye" }
Is there a convenient w...
Arlenarlena asked 12/2, 2012 at 9:12
6
Solved
I have an ActiveRecord Model, PricePackage. That has a before_create call back. This call back uses a 3rd party API to make a remote connection. I am using factory girl and would like to stub out t...
Mayes asked 25/9, 2011 at 5:12
1
Solved
I have a model similar to the following:
class Foo
attr_accessor :attribute_a # Really an ActiveRecord attribute
attr_accessor :attribute_b # Also an ActiveRecord attribute
def determine_attri...
Amagasaki asked 4/1, 2012 at 23:7
2
Okay, so i've set up a many-to-many association for users, projects and the ability to watch those projects. (Called, not the best name I've ever come up with "Watchings")
#project.rb
class Projec...
Demagogue asked 27/12, 2011 at 23:10
2
Solved
I've very green to this TDD business, so any help would be fantastic!
So, I've got a factory with the following:
FactoryGirl.define do
factory :account do
email "[email protected]"
url "...
Flosser asked 8/12, 2011 at 23:40
1
Solved
I have a Posts controller and I have just installed Devise to add some authentication quickly and easily. Before I installed Devise, I had created some tests for the 'new' action of my Posts contro...
Assuan asked 28/11, 2011 at 19:47
1
Solved
I have trying to solve an issue with my Spec tests and I get the following error
Failures:
1) SessionsController POST 'create' with valid email and password should sign in the user
Failure/Error...
Amoebic asked 27/11, 2011 at 15:9
1
Solved
If I have types defined in a module inside a model, and an array of these types also defined in the same model, how can I call a value from this array randomly when defining a new factory?
Thanks!...
Xylophone asked 22/11, 2011 at 6:53
1
Solved
I've been trying to get a grasp on writing tests, but having a lot of trouble as the tests never seem to validate the way I want them to. In particular, I've been trying to use Factory Girl as oppo...
Cammack asked 21/11, 2011 at 17:59
2
Solved
When building the following factory:
Factory.define :user do |f|
f.sequence(:name) { |n| "foo#{n}" }
f.resume_type_id { ResumeType.first.id }
end
ResumeType.first returns nil and I get an erro...
Tripartite asked 28/4, 2010 at 19:43
3
A little confused here, what is the difference between a factory and a fixture?
So I'm using factory_girl, when I create an object using the factory, should it be persisted to the db? Or is that wh...
Sapphirine asked 16/10, 2011 at 18:3
2
Solved
This is my Gemfile config:
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl', '~>2.0.0.beta1'
gem 'factory_girl_rails', :git => 'https://github.com/thoughtbot/factory_girl...
Tocopherol asked 14/3, 2011 at 12:11
3
Solved
I'm using Factory Girl/Rspec2/Rails 3.
In factories.rb, I have:
Factory.define :user do |user|
user.name 'Some guy'
user.email '[email protected]'
user.password 'password'
end
Factory.de...
Recoup asked 26/10, 2010 at 19:7
1
Solved
This is an additional note to the question "Factory Girl - what's the purpose?"
I'm not sure whether my question is counted as a repetitive one, but I'm simply still not very clear after reading t...
Diaconicum asked 1/10, 2011 at 8:18
13
Solved
I'm trying to set up Factory Girl with Test::Unit and Shoulda in Ruby on Rails. I have installed the gem, created my factory file under the test/factories directory, and created my spec file under ...
Amor asked 21/7, 2009 at 15:38
2
Solved
I'm pretty new to rspec and the whole TDD methodology. Can someone please explain the difference between mock and stub. When do we use them and when do we use Factory Girl to create objects in test...
Damascene asked 7/9, 2011 at 21:38
1
Solved
I am using FactoryGirl to create a "Specialty" model that has a unique index on the code column.
When I create multiple factories of the "Specialty" model I get this error:
Failure/Error: Factory...
Martie asked 21/8, 2011 at 0:33
2
Solved
I'm trying to Factory a Post associated with a Vote. So that Post.votes would generate the Vote's that are associated with it.
Factory.define :voted_post, :parent => :post, :class => Post do...
Prosperus asked 21/9, 2010 at 2:28
© 2022 - 2024 — McMap. All rights reserved.