Sha256: 5eaeb931e2b671728a0363809def9129aac4e05d84286820c56c83a457f660b8

Contents?: true

Size: 1.45 KB

Versions: 20

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_attribute(:end_date, nil)

      first = create(
        :participatory_process,
        :with_steps,
        :published,
        :promoted,
        organization: organization,
        end_date: Time.current.advance(days: 10)
      )
      first.active_step.update_attribute(: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_attribute(: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

20 entries across 20 versions & 2 rubygems

Version Path
decidim-dev-0.6.8 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.8 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.7 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.7 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.6 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.6 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.5 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.5 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.4 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.4 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.3 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.3 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.2 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.2 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.1 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.1 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-dev-0.6.0 lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.6.0 decidim-dev/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb
decidim-0.5.1 decidim-core/spec/shared/with_promoted_participatory_processes_examples.rb
decidim-0.5.0 decidim-core/spec/shared/with_promoted_participatory_processes_examples.rb