Merge branch 'proposals' of github.com:AyuntamientoMadrid/participacion into proposals

This commit is contained in:
rgarcia
2015-09-12 12:30:32 +02:00

View File

@@ -101,6 +101,48 @@ FactoryGirl.define do
end
end
factory :proposal do
sequence(:title) { |n| "Proposal #{n} title" }
description 'Proposal description'
question 'Proposal question'
external_url 'http://decide.madrid.es'
terms_of_service '1'
association :author, factory: :user
trait :hidden do
hidden_at Time.now
end
trait :with_ignored_flag do
ignored_flag_at Time.now
end
trait :with_confirmed_hide do
confirmed_hide_at Time.now
end
trait :flagged do
after :create do |debate|
Flag.flag(FactoryGirl.create(:user), debate)
end
end
trait :with_hot_score do
before(:save) { |d| d.calculate_hot_score }
end
trait :with_confidence_score do
before(:save) { |d| d.calculate_confidence_score }
end
trait :conflictive do
after :create do |debate|
Flag.flag(FactoryGirl.create(:user), debate)
4.times { create(:vote, votable: debate) }
end
end
end
factory :vote do
association :votable, factory: :debate
association :voter, factory: :user