This gem allows you to use difftastic-ruby in place of RSpec's default differ.
This is a quick patch implementation and may not cover edge cases.
When an RSpec test fails, the output includes so much red text that reading the diff takes more time than it should.
A few attempts have been made to improve the developer experience with RSpec failures (e.g., super_diff and a new default differ).
Integrating difftastic-ruby with RSpec makes another attempt at outputting diffs that are easier to read upon RSpec failures.
ruby example-rspec-diff.rb
So much red to scan.

ruby example-rspec-diff-with-super_diff.rb
Red is replaced with white, magenta, and yellow - easily readible!

ruby example-rspec-diff-with-rspec-difftastic.rb
Red and green is side-by-side. Word-level diff to highlight that the last name is different.

Here are two example that use matchers for comparison.
it do
expect(
unknown: 'any value is acceptable',
number: 1,
).to match(
unknown: anything,
number: '1',
)
end
it do
expect(
nested_hash: { some_key: :some_value },
number: 1,
).to match(
nested_hash: hash_including(:some_key),
number: '1',
)
end
The lack of emphasis on the problem ("1"
vs 1
) may have some developers wondering if they're incorrectly using matchers.

In the first diff, super_diff
arguably makes the diff worse by outputting the matcher's class name.
In the second diff, the matcher is cleanly left out of the diff.

In the first diff rspec-difftastic
diff strings and objects, so the matcher class name is shown, and can lead to being a distracting red herring especially if the reader is accustomed to relying on the +/- notation of RSpec diffs.

Install the development dependencies:
bundle install
Confirm the spec suite is passing:
bundle exec rspec
Make your modifications and submit a PR.