Sha256: b68ac6382ecb8d44a1d77fe0bff25845440e3f9739d794b06731be9c2b32f45f

Contents?: true

Size: 953 Bytes

Versions: 2

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

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

  let(:params) do
    {
      name: "Gotham City",
      host: "decide.lvh.me",
      organization_admin_email: "f.laguardia@gotham.gov"
    }
  end

  before(:each) do
    Decidim::System::RegisterOrganization.new(form).call
    switch_to_host("decide.lvh.me")
  end

  describe "Accept an invitation", perform_enqueued: true do
    let(:email_link) do
      last_delivery = ActionMailer::Base.deliveries.last.body.encoded
      URI.extract(last_delivery).last
    end

    it "asks for a password and redirects to the organization dashboard" do
      visit email_link

      fill_in :user_password, with: "123456"
      fill_in :user_password_confirmation, with: "123456"
      find("*[type=submit]").click

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-0.0.1.alpha4 decidim-admin/spec/features/admin_invite_spec.rb
decidim-0.0.1.alpha3 decidim-admin/spec/features/admin_invite_spec.rb