This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use newer FG syntax in factories defs
- Loading branch information
1 parent
b3c474f
commit f9ce3e5
Showing
1 changed file
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |