Adds/improves factories

This commit is contained in:
kikito
2016-05-23 19:50:11 +02:00
parent d4d16d3006
commit d663e4c594

View File

@@ -1,5 +1,4 @@
FactoryGirl.define do
sequence(:document_number) { |n| "#{n.to_s.rjust(8, '0')}X" }
factory :user do
@@ -192,6 +191,19 @@ FactoryGirl.define do
factory :budget do
sequence(:name) { |n| "Budget #{n}" }
currency_symbol ""
phase 'on_hold'
trait :selecting do
phase 'selecting'
end
trait :balloting do
phase 'balloting'
end
trait :finished do
phase 'finished'
end
end
factory :budget_heading, class: 'Budget::Heading' do
@@ -200,13 +212,18 @@ FactoryGirl.define do
price 1000000
end
factory :budget_investment, class: 'Budget::Investment' do
sequence(:title) { |n| "Investment #{n} title" }
factory :budget_investment, class: Budget::Investment do
sequence(:title) { |n| "Budget Investment #{n} title" }
association :budget
association :author, factory: :user
description 'Spend money on this'
price 1000
unfeasibility_explanation ''
external_url 'http://external_documention.org'
terms_of_service '1'
association :author, factory: :user
trait :with_confidence_score do
before(:save) { |i| i.calculate_confidence_score }
end
trait :feasible do
feasibility "feasible"
@@ -359,8 +376,5 @@ FactoryGirl.define do
census_code { '01' }
end
factory :budget do
sequence(:name) {|n| "Budget #{n}" }
phase "on_hold"
end
end