Skip to content

Bad nested Aggregate failures reporting #6

Open
@Startouf

Description

@Startouf

Given the following test

context 'with a sideloading request' do
        let(:user) { create(:user, :with_school, tag_count: 1}
        before(:each) do
          get profile_url(params: { include: [:school, :tags].join(',') })
        end

        it 'renders the sideloaded entities in the JSON' do
          expect(json_included_types).to include('school', 'tag')
          aggregate_failures('sideloaded entities') do
            assert_payload(:'public/school', user.school, json_include('school'))
            assert_payload(:'public/tag', user.tags.first, json_include('tag'))
          end
        end
      end
end

The output provided on the nested aggregate_failure > assert_payload is quite enigmatic

Got 2 failures and 1 other error from failure aggregation block "sideloaded entities".
     [Backtrace]
     1.1) Got 2 failures from failure aggregation block "payload has correct key/values".
          [Backtrace]
          1.1.1) Failure/Error: assign_backtrace(failure) unless failure.backtrace
                   Expected JSON payload to have key 'created_at' but was not present
                 [Backtrace]
          1.1.2) Failure/Error: assign_backtrace(failure) unless failure.backtrace
                   Expected JSON payload to have key 'updated_at' but was not present
                 [Backtrace]

The weird part here is

1.1.1) Failure/Error: assign_backtrace(failure) unless failure.backtrace

Whereas the usual error message should repeat the error line like
Failure/Error: assert_payload(:'public/school', user.school, json_include('school'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions