This mapping has 3 multi-map groups: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

Before

…lines 1–43 unchanged (43 lines)
44 context 'when the collection item is inlined' do
45 let(:object) { featured_item_json }
46
47 it_behaves_like 'non-matching URIs'
48
49 context 'when item does not yet exist' do
50 it 'creates and verifies the item' do
51 expect { subject.call(collection, object, position:) }.to change(collection.collection_items, :count).by(1)
52
53 expect(stubbed_service).to have_received(:call)
54
55 new_item = collection.collection_items.last
56 expect(new_item.object_uri).to eq 'https://example.com/actor/1'
57 expect(new_item.approval_uri).to be_nil
58 expect(new_item.position).to eq 3
59 end
60 end
61
62 context 'when item exists at a different position' do
63 let!(:collection_item) do
64 Fabricate(:collection_item, collection:, uri: featured_item_json['id'], position: 2)
65 end
66
…lines 67–116 unchanged (50 lines)

After

…lines 1–43 unchanged (43 lines)
44 context 'when the collection item is inlined' do
45 let(:object) { featured_item_json }
46
47 it_behaves_like 'non-matching URIs'
48
49 context 'when item does not yet exist' do
50 context 'when a position is given' do
51 it 'creates and verifies the item' do
52 expect { subject.call(collection, object, position:) }.to change(collection.collection_items, :count).by(1)
53
54 expect(stubbed_service).to have_received(:call)
55
56 new_item = collection.collection_items.last
57 expect(new_item.object_uri).to eq 'https://example.com/actor/1'
58 expect(new_item.approval_uri).to be_nil
59 expect(new_item.position).to eq 3
60 end
61 end
62
63 context 'when no position is given' do
64 it 'creates the item' do
65 expect { subject.call(collection, object) }.to change(collection.collection_items, :count).by(1)
66 new_item = collection.collection_items.last
67
68 expect(new_item.position).to eq 1
69 end
70 end
71 end
72
73 context 'when item exists at a different position' do
74 let!(:collection_item) do
75 Fabricate(:collection_item, collection:, uri: featured_item_json['id'], position: 2)
76 end
77
…lines 78–127 unchanged (50 lines)

Before

program
comment "# frozen_string_literal: true"
call
identifier "require"
argument_list
string
" "'"
string_content "rails_helper"
" "'"
call
constant "RSpec"
. "."
identifier "describe"
argument_list
scope_resolution
constant "ActivityPub"
:: "::"
constant "ProcessFeaturedItemService"
do_block
do "do"
body_statement
call
identifier "include"
argument_list
constant "RoutingHelper"
call
identifier "subject"
block
{ "{"
block_body
call
identifier "described_class"
. "."
identifier "new"
} "}"
call (+24 nodes collapsed)
call
identifier "let"
argument_list
( "("
simple_symbol ":position"
) ")"
block
{ "{"
block_body
integer "3"
} "}"
call
identifier "let"
argument_list
( "("
simple_symbol ":featured_object_uri"
) ")"
block
{ "{"
block_body
string
" "'"
string_content "https://example.com/actor/1"
" "'"
} "}"
call
identifier "let"
argument_list
( "("
simple_symbol ":feature_authorization_uri"
) ")"
block
{ "{"
block_body
string
" "'"
string_content "https://example.com/auth/1"
" "'"
} "}"
call (+73 nodes collapsed)
call (+24 nodes collapsed)
call (+32 nodes collapsed)
call (+91 nodes collapsed)
call
identifier "context"
argument_list
string
" "'"
string_content "when the collection item is inlined"
" "'"
do_block
do "do"
body_statement
call
identifier "let"
argument_list
( "("
simple_symbol ":object"
) ")"
block
{ "{"
block_body
identifier "featured_item_json"
} "}"
call
identifier "it_behaves_like"
argument_list
string
" "'"
string_content "non-matching URIs"
" "'"
call
identifier "context"
argument_list
string
" "'"
string_content "when item does not yet exist"
" "'"
do_block any 1:2
do "do" any 1:2
body_statement any 1:2
call (+130 nodes collapsed)
end "end"
call (+114 nodes collapsed)
call (+153 nodes collapsed)
end "end"
call (+201 nodes collapsed)
end "end"

After

program
comment "# frozen_string_literal: true"
call
identifier "require"
argument_list
string
" "'"
string_content "rails_helper"
" "'"
call
constant "RSpec"
. "."
identifier "describe"
argument_list
scope_resolution
constant "ActivityPub"
:: "::"
constant "ProcessFeaturedItemService"
do_block
do "do"
body_statement
call
identifier "include"
argument_list
constant "RoutingHelper"
call
identifier "subject"
block
{ "{"
block_body
call
identifier "described_class"
. "."
identifier "new"
} "}"
call (+24 nodes collapsed)
call
identifier "let"
argument_list
( "("
simple_symbol ":position"
) ")"
block
{ "{"
block_body
integer "3"
} "}"
call
identifier "let"
argument_list
( "("
simple_symbol ":featured_object_uri"
) ")"
block
{ "{"
block_body
string
" "'"
string_content "https://example.com/actor/1"
" "'"
} "}"
call
identifier "let"
argument_list
( "("
simple_symbol ":feature_authorization_uri"
) ")"
block
{ "{"
block_body
string
" "'"
string_content "https://example.com/auth/1"
" "'"
} "}"
call (+73 nodes collapsed)
call (+24 nodes collapsed)
call (+32 nodes collapsed)
call (+91 nodes collapsed)
call
identifier "context"
argument_list
string
" "'"
string_content "when the collection item is inlined"
" "'"
do_block
do "do"
body_statement
call
identifier "let"
argument_list
( "("
simple_symbol ":object"
) ")"
block
{ "{"
block_body
identifier "featured_item_json"
} "}"
call
identifier "it_behaves_like"
argument_list
string
" "'"
string_content "non-matching URIs"
" "'"
call
identifier "context"
argument_list
string
" "'"
string_content "when item does not yet exist"
" "'"
do_block any 1:2
do "do" any 1:2
body_statement any 1:2
call
identifier "context"
argument_list
string
" "'"
string_content "when a position is given"
" "'"
do_block any 1:2
do "do" any 1:2
body_statement any 1:2
call (+130 nodes collapsed)
end "end"
call
identifier "context"
argument_list
string
" "'"
string_content "when no position is given"
" "'"
do_block
do "do"
body_statement
call
identifier "it"
argument_list
string
" "'"
string_content "creates the item"
" "'"
do_block
do "do"
body_statement
call
call
identifier "expect"
block
{ "{"
block_body
call
identifier "subject"
. "."
identifier "call"
argument_list
( "("
identifier "collection"
, ","
identifier "object"
) ")"
} "}"
. "."
identifier "to"
argument_list
call
call
identifier "change"
argument_list
( "("
call
identifier "collection"
. "."
identifier "collection_items"
, ","
simple_symbol ":count"
) ")"
. "."
identifier "by"
argument_list
( "("
integer "1"
) ")"
assignment
identifier "new_item"
= "="
call
call
identifier "collection"
. "."
identifier "collection_items"
. "."
identifier "last"
call
call
identifier "expect"
argument_list
( "("
call
identifier "new_item"
. "."
identifier "position"
) ")"
. "."
identifier "to"
argument_list
call
identifier "eq"
argument_list
integer "1"
end "end"
end "end"
end "end"
call (+114 nodes collapsed)
call (+153 nodes collapsed)
end "end"
call (+201 nodes collapsed)
end "end"