You cannot post messages because only members can post, and you are not currently a member.
Description:
Discussion and assistance related to the factory_girl Gem for Ruby.
|
|
|
How to access the curent factories attributes
|
| |
Lets say I have the following factory: FactoryGirl.define do factory :user do first_name: { Faker::Name.first_name } last_name: { Faker::Name.last_name } user_name: { "#{first_name.first}_#{last_na me}" } end end Quite obviously this doesn't work, but how can I make it work to access the... more »
|
|
separate use of factory_girl and factory_girl_rails?
|
| |
I have an application that uses Redis::Objects in some models (no AR) and ActiveRecord::Base for traditional Rails models. Is there a way for me to use FactoryGirl for the former yet FactoryGirlRails for the latter?
|
|
Sharing factories via a gem?
|
| |
I have a set of models that are shared between Rails applications, and currently live in a gem. I would like to share the factories that are associated with them as well. Whats the best way to do this? Don't necessarily want to have to write a generator and dump them out, would prefer to include them somehow.... more »
|
|
polymorphic association error ..
|
| |
I have the following models
class Partner < ActiveRecord::Base
has_many :payment_terms, :dependent => :destroy, :as => :term able
class PaymentTerm < ActiveRecord::Base
belongs_to :termable, :polymorphic => true
I defined the payment_term factory like that :
FactoryGirl.define do... more »
|
|
add_attribute': Both value and block given
|
| |
I am trying to add (my first) after(;create in a factory, and I get
this error ...
gems/factory_girl-3.2.0/lib/fa ctory_girl/definition_proxy.rb :36:in
`add_attribute': Both value and block given
(FactoryGirl::AttributeDefinit ionError)
I have an Admin model
class Admin < ActiveRecord::Base... more »
|
|
how to force an associated object when seeding data
|
| |
I am trying to seed data in my test DB using factory_girls
I have some static data created like :
puts "CREATE AREAS"
west = Area.create(name: "West)
north = Area.create(name: "North)
east = Area.create(name: "East)
south = Area.create(name: "South)
..
and I wrote
FactoryGirl.define do
factory :partner do... more »
|
|
How does FG track named associations in it's step definitions?
|
| |
I've seen this in examples but I just wanted to understand better how
it works. This is a contrived example based off of FG's own functional
tests:
Scenario: create post with and without a category association
Given the following users exist:
| ID | Name |
| 123 | Joe |
And the following posts exist:... more »
|
|
Transient attribute gives "undefined method `name' for false:FalseClass"
|
| |
The code below work if I substitute the "sub" on the last line with a number say 99. Why can I not access the transient attribute "sub" when setting this association? factory :tx_link do units 9.99 factory :link_to_sub do ignore do sub 0 end units { sub } giver { |tx| tx.association(:transaction, units: sub) }... more »
|
|
"curl: (3) <url> malformed" error
|
| |
Hi all,
I am using factory_girl (3.2.0) in Rspec tests and have been getting
an error (curl: (3) <url> malformed) when I call FactoryGirl.create
(and FactoryGirl.build) for one of my Models. I have traced the error
to what I believe to be something in the FactoryGirl callback methods
(rather than my Model) since creating a Model without FactoryGirl... more »
|
|
|