Refactor Poll creation section, no need to use variables and big date ranges

This commit is contained in:
Bertocq
2017-11-09 13:02:18 +01:00
parent 5a188474c5
commit a4a4f3beb2

View File

@@ -524,46 +524,46 @@ end
section "Creating polls" do
@poll_active = Poll.create(name: "Active Poll",
# TODO: Uncomment when Poll get slugs
# slug: "active-poll",
starts_at: 1.month.ago,
ends_at: 1.month.from_now,
geozone_restricted: false)
Poll.create(name: "Current Poll",
# TODO: Uncomment when Poll get slugs
# slug: "current-poll",
starts_at: 7.days.ago,
ends_at: 7.days.from_now,
geozone_restricted: false)
@poll_active_geolocalized = Poll.create(name: "Active Poll Restricted",
# TODO: Uncomment when Poll get slugs
# slug: "active-poll-restricted",
starts_at: 1.month.ago,
ends_at: 1.month.from_now,
geozone_restricted: true,
geozones: Geozone.reorder("RANDOM()").limit(3))
Poll.create(name: "Current Poll Geozone Restricted",
# TODO: Uncomment when Poll get slugs
# slug: "current-poll-geozone-restricted",
starts_at: 5.days.ago,
ends_at: 5.days.from_now,
geozone_restricted: true,
geozones: Geozone.reorder("RANDOM()").limit(3))
poll = Poll.create(name: "Upcoming Poll",
# TODO: Uncomment when Poll get slugs
# slug: "upcoming-poll",
starts_at: 1.month.from_now,
ends_at: 2.months.from_now)
Poll.create(name: "Incoming Poll",
# TODO: Uncomment when Poll get slugs
# slug: "incoming-poll",
starts_at: 1.month.from_now,
ends_at: 2.months.from_now)
poll = Poll.create(name: "Recounting Poll",
# TODO: Uncomment when Poll get slugs
# slug: "recounting-poll",
starts_at: 1.month.ago,
ends_at: 5.days.ago)
Poll.create(name: "Recounting Poll",
# TODO: Uncomment when Poll get slugs
# slug: "recounting-poll",
starts_at: 15.days.ago,
ends_at: 2.days.ago)
@poll_expired = Poll.create(name: "Expired Poll",
# TODO: Uncomment when Poll get slugs
# slug: "expired-poll",
starts_at: 2.months.ago,
ends_at: 1.month.ago)
Poll.create(name: "Expired Poll without Stats & Results",
# TODO: Uncomment when Poll get slugs
# slug: "expired-poll-without-stats-and-results",
starts_at: 2.months.ago,
ends_at: 1.month.ago)
poll = Poll.create(name: "Expired Poll with Stats & Results",
# TODO: Uncomment when Poll get slugs
# slug: "expired-poll-with-stats-and-results",
starts_at: 2.months.ago,
ends_at: 1.month.ago,
results_enabled: true,
stats_enabled: true)
Poll.create(name: "Expired Poll with Stats & Results",
# TODO: Uncomment when Poll get slugs
# slug: "expired-poll-with-stats-and-results",
starts_at: 2.months.ago,
ends_at: 1.month.ago,
results_enabled: true,
stats_enabled: true)
end
section "Creating Poll Questions" do