Sha256: cf52359a504ede4c1f33c393bee2d641c58d41c32f2229d99938f2062646fcab

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe "Admin invite", type: :feature do
  let(:form) do
    Decidim::System::RegisterOrganizationForm.new(params)
  end

  let(:homepage_image_path) do
    File.expand_path(
      File.join(__dir__, "..", "..", "..", "decidim-dev", "spec", "support", "city.jpeg")
    )
  end

  let(:params) do
    {
      name: "Gotham City",
      reference_prefix: "JKR",
      host: "decide.lvh.me",
      organization_admin_name: "Fiorello Henry La Guardia",
      organization_admin_email: "f.laguardia@gotham.gov",
      welcome_text_en: "Welcome",
      homepage_image: Rack::Test::UploadedFile.new(homepage_image_path, "image/jpg"),
      available_locales: ["en"],
      default_locale: "en"
    }
  end

  before do
    expect { Decidim::System::RegisterOrganization.new(form).call }.to broadcast(:ok)
    switch_to_host("decide.lvh.me")
  end

  describe "Accept an invitation", perform_enqueued: true do
    it "asks for a password and redirects to the organization dashboard" do
      visit last_email_link

      within "form.new_user" do
        fill_in :user_password, with: "123456"
        fill_in :user_password_confirmation, with: "123456"
        find("*[type=submit]").click
      end

      within ".callout-wrapper" do
        page.find(".close-button").click
      end

      expect(page).to have_content("DASHBOARD")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-0.4.4 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.4.3 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.4.2 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.4.1 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.4.0 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.3.2 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.3.1 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.3.0 decidim-admin/spec/features/admin_invite_spec.rb