Sha256: 8387847960a1d8ba66279e666371cbfe71eba532146d5835073c67afd9c2a55f
Contents?: true
Size: 1.45 KB
Versions: 9
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true shared_examples "with promoted participatory processes" do before do request.env["decidim.current_organization"] = organization end describe "promoted_participatory_processes" do it "orders them by active_step end_date" do create( :participatory_process, :with_steps, :unpublished, :promoted, organization: organization ) create( :participatory_process, :with_steps, :unpublished, organization: organization ) last = create( :participatory_process, :with_steps, :published, :promoted, organization: organization ) last.active_step.update_attributes!(end_date: nil) first = create( :participatory_process, :with_steps, :published, :promoted, organization: organization, end_date: Time.current.advance(days: 10) ) first.active_step.update_attributes!(end_date: Time.current.advance(days: 2)) second = create( :participatory_process, :with_steps, :published, :promoted, organization: organization, end_date: Time.current.advance(days: 8) ) second.active_step.update_attributes!(end_date: Time.current.advance(days: 4)) expect(controller.helpers.promoted_participatory_processes) .to match_array([first, second, last]) end end end
Version data entries
9 entries across 9 versions & 1 rubygems