jimweirich / rspec-given

Given/When/Then keywords for RSpec Specifications
https://github.com/jimweirich/rspec-given
MIT License
653 stars 61 forks source link

Feature: string diffs when comparing strings #41

Open olerass opened 10 years ago

olerass commented 10 years ago

It would be really neat if rspec-given could display the diffs when two strings are compared in a Then or And. So for example instead of this:

Then expression failed at [...]
expected: "Hello how are you today!"
to equal: "Helio how are you today!"
  false            <- str1 == str2
  "Hello how are you today!"          <- str1
  "Helio how are you today!"   <- str2

It would display the strings diffed next to/below each other and maybe even color coded according to differences. E.g. the example at the bottom here is quite nice: http://drasticcode.com/2010/11/26/the-easiest-way-to-diff-two-strings-in-ruby

jirutka commented 10 years ago

+1, I recommend to use Diffy.