Sha256: ffbd512ca6bd4dbde8dc294c9858a6c507e3e98ec46e559c3184a93cf8c7650e

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe "Admin explores processes", type: :system do
  let(:organization) { create(:organization) }
  let!(:area) { create(:area, organization: organization) }
  let!(:process) { create(:participatory_process, organization: organization, area: area) }

  let!(:admin) { create(:user, :admin, :confirmed, organization: organization) }

  before do
    switch_to_host(organization.host)
    login_as admin, scope: :user
  end

  describe "when there are admins of all types" do
    let!(:department_admin) do
      user = create(:user, :confirmed, organization: organization)
      user.roles << "department_admin"
      user.areas << area
      user.save!
      user
    end

    context "when visiting the list of participatory processes" do
      before do
        visit decidim_admin_participatory_processes.participatory_processes_path
      end

      it "renders a new column for the process department (aka area)" do
        check_column_header_exists(position: 2, content: "Department/Area")
        check_column_data_exists(position: 2, content: area.name["en"])
        check_column_data_exists(position: 3, content: department_admin.name)
      end

      it "renders a new column for the department admins in the process"
      it "renders a new column for the process admins in the process"
    end
  end

  def check_column_header_exists(position: 1, content: "")
    within "#processes .card-section .table-scroll table thead th:nth-child(#{position})" do
      expect(page).to have_content(content)
    end
  end

  def check_column_data_exists(position: 1, content: "")
    within "#processes .card-section .table-scroll table tbody td:nth-child(#{position})" do
      expect(page).to have_content(content)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-department_admin-0.7.2 spec/system/admin_explores_processes_spec.rb