Sha256: 78c1c72306c5a005140e55b7627d305b4bf8a7f3aca3182854be51b51cdf9ee6

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

shared_context "authorization transfer" do
  let(:organization) { create(:organization) }
  let(:original_user) { create(:user, :confirmed, :deleted, organization:) }
  let(:target_user) { create(:user, :confirmed, organization:) }
  let(:authorization_document_number) { "12345678X" }
  let(:authorization) { create(:authorization, :granted, user: original_user, unique_id: authorization_document_number) }
  let(:authorization_handler) do
    DummyAuthorizationHandler.from_params(
      document_number: authorization_document_number,
      user: target_user
    )
  end
  let(:transfer) do
    create(
      :authorization_transfer,
      authorization:,
      user: authorization_handler.user,
      source_user: original_user
    )
  end
  let(:transferred_resources) { transfer.records.map(&:resource).sort_by! { |r| "#{r.class.name}##{format("%010d", r.id)}" } }

  before do
    # Make sure the original records exist before publishing the notification
    original_records

    # The initializer should have already been run when the test starts, so when
    # the transfer is announced, it should handle the event subscription
    # correctly if it has run and works as expected.
    transfer.announce!(authorization_handler)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
decidim-core-0.30.0.rc2 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.30.0.rc1 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.2 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.5 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.1 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.4 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.0 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.3 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.0.rc4 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.0.rc3 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.0.rc2 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.29.0.rc1 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.2 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.1 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.0 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.0.rc5 lib/decidim/core/test/shared_examples/authorization_shared_context.rb
decidim-core-0.28.0.rc4 lib/decidim/core/test/shared_examples/authorization_shared_context.rb