Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
use newer FG syntax in factories defs
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Sep 4, 2011
1 parent b3c474f commit f9ce3e5
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions spec/factories.rb
@@ -1,17 +1,26 @@
Factory.sequence(:age) { |n| n.to_i }
Factory.sequence(:rating) { |n| n.to_f }
FactoryGirl.define do

Factory.define :comment do |f|
f.association :user
end
sequence :age do |n|
n.to_i
end

Factory.define :mammal do |f|
end
sequence :rating do |n|
n.to_f
end

Factory.define :post do |f|
end
factory :comment do
association :user
end

factory :mammal do
end

factory :post do
end

factory :user do
age { Factory.next :age }
rating { Factory.next :rating }
end

Factory.define :user do |f|
f.age { Factory.next :age }
f.rating { Factory.next :rating }
end

0 comments on commit f9ce3e5

Please sign in to comment.