Sha256: 6289e1fc77ddfeb78a3948643559f66c2a8070163f9bc55b08db8aa1757e686b

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

shared_examples "manage participatory space publications" do |_options|
  before do
    participatory_space.update(title: { en: title })
    switch_to_host(organization.host)
    login_as user, scope: :user
  end

  context "when the participatory space is unpublished" do
    before do
      participatory_space.unpublish!
      participatory_space.reload
      visit admin_page_path
    end

    it "publishes it" do
      click_on "Publish"

      expect(page).to have_content("successfully")

      visit public_collection_path

      expect(page).to have_content title
    end
  end

  context "when the participatory space is published" do
    before do
      allow(Rails.application).to \
        receive(:env_config).with(no_args).and_wrap_original do |m, *|
          m.call.merge(
            "action_dispatch.show_exceptions" => true,
            "action_dispatch.show_detailed_exceptions" => false
          )
        end
      participatory_space.publish!
      participatory_space.reload
      visit admin_page_path
    end

    it "unpublishes it" do
      # we cannot use "a 404 page" shared example as we want to check it
      # inside an example
      click_on "Unpublish"

      expect(page).to have_content("successfully")

      visit public_collection_path

      expect(page).to have_content("The page you are looking for cannot be found")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb
decidim-admin-0.29.0 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb
decidim-admin-0.29.0.rc4 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb
decidim-admin-0.29.0.rc3 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb
decidim-admin-0.29.0.rc2 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb
decidim-admin-0.29.0.rc1 lib/decidim/admin/test/manage_participatory_space_publications_examples.rb