When RSpec sets out to print any given object to the console, it will never print more than 200 characters from it Show archive.org snapshot . Only the first and last 100 chars from overly long strings are displayed, which sometimes means that the root cause for the failing test is buried in truncation.
For example, I could not easily make out the reason for this failure:
Failure/Error: expect { crawler.pull_new_commits }.not_to raise_error
expected no Exception, got #<GitLab::RepositoryCrawler::GitPullError:"an error occurred while pulling makandra AI to data-source...ward, aborting.\n\ngit pull --quiet --no-tags --force --no-all --ff-only origin ml/force-push-test"> with backtrace:
You can tweak this limit by setting the truncation threshold like so:
# spec/spec_helper.rb
RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 1000
Now, the key information ("fatal: Not possible to fast-forward") is visible in the failing test output:
Failure/Error: expect { crawler.pull_new_commits }.not_to raise_error
expected no Exception, got #<GitLab::RepositoryCrawler::GitPullError:"an error occurred while pulling makandra AI to data-sources/test/gitlab/makandra/ai.makandra.de: fatal: Not possible to fast-forward, aborting.\n\ngit pull --quiet --no-tags --force --no-all --ff-only origin ml/force-push-test"> with backtrace:
Posted by Michael Leimstädtner to makandra dev (2025-10-13 09:41)