Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blows up on 2.0.4 #20

Closed
itsbagpack opened this issue Feb 18, 2014 · 0 comments
Closed

Blows up on 2.0.4 #20

itsbagpack opened this issue Feb 18, 2014 · 0 comments

Comments

@itsbagpack
Copy link

require 'factory_girl'

class Post
  attr_accessor :title, :description
  def save!
  end
end


# main factory
FactoryGirl.define do
  factory :post do
    title "some title"
    self
    method(:factory).source_location
  end
end

# use modify to add the trait
FactoryGirl.modify do
  factory :post do
    trait :with_desc do
      description "some desc"
    end
    method(:factory).source_location
    factory :described_post, traits: [:with_desc]
  end
end



FactoryGirl.create :post, :with_desc
FactoryGirl.create :described_post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant