Sha256: 72bd116be1e5da54a4c87f2ba63a0f445246cf63b21319da307235f82c35e932

Contents?: true

Size: 1.31 KB

Versions: 41

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

shared_examples_for "an embed resource" do |options|
  if options.is_a?(Hash) && options[:skip_space_checks]
    let(:organization) { resource.organization }

    before do
      switch_to_host(organization.host)
    end
  else
    include_context "with a component"
  end

  context "when visiting the embed page for a resource" do
    before do
      visit resource_locator(resource).path
      visit "#{current_path}/embed"
    end

    it "renders the page correctly" do
      if resource.title.is_a?(Hash)
        expect(page).to have_i18n_content(resource.title)
      else
        expect(page).to have_content(resource.title)
      end

      expect(page).to have_content(organization.name)
    end

    unless options.is_a?(Hash) && options[:skip_space_checks]
      context "when the participatory_space is a process" do
        it "shows the process name" do
          expect(page).to have_i18n_content(participatory_process.title)
        end
      end

      context "when the participatory_space is an assembly" do
        let(:assembly) do
          create(:assembly, organization: organization)
        end
        let(:participatory_space) { assembly }

        it "shows the assembly name" do
          expect(page).to have_i18n_content(assembly.title)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.5 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.4 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.3 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.2 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.1 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.0 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.0.rc2 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.27.0.rc1 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.1 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.0 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.0.rc2 lib/decidim/core/test/shared_examples/embed_resource_examples.rb
decidim-core-0.26.0.rc1 lib/decidim/core/test/shared_examples/embed_resource_examples.rb