Skip to content

Bad nested Aggregate failures reporting #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Startouf opened this issue Jul 17, 2017 · 0 comments
Open

Bad nested Aggregate failures reporting #6

Startouf opened this issue Jul 17, 2017 · 0 comments

Comments

@Startouf
Copy link

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'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant