I have a test in RSpec which compares to long text strings. When the test fails, I get a message like this:
'jobs partial should render the correct format for jobs' FAILED
expected: "Job {\n\tName = \"name1-etc\"\n\tType = Backup\n\tMessages = Daemon\n\tPool = Default
\n\tSchedule = \"schedule1\"\n\tStorage = storage1\n\tClient = \"name1\"\n\tFileset = \"fileset1
\"\n\tMax Wait Time = 5m\n\tWrite Bootstrap = \"/var/lib/bacula/name1-etc.bsr\"\n}\n\n",
got: "Job {\n\tName = \"name1-etc\"\n\tType = Backup\n\tMessages = Daemon\n\tPool = Default
\n\tSchedule = \"schedule1\"\n\tStorage = storage1\n\tClient = \"name1\"\n\tFileset = \"fileset1
\"\n\tMax Wait Time = 5m\n\tWrite Bootstrap = \"/var/lib/bacula/name1-etc.bsr\"\n}\n\n" (using =
=)
How do I do to make RSpec and autotest respond a nicely formated diff (if possible, coloring the differences between texts? Something like this
expected:
Job {
Name = "name1-etc"
Type = Backup
Messages = Daemon
Pool = Default
Schedule = "schedule1"
Storage = storage1
Client = "name1"
Fileset = "fileset1" <--diff
Max Wait Time = 5m
Write Bootstrap = "/var/lib/bacula/name1-etc.bsr"
}
got:
Job {
Name = "name1-etc"
Type = Backup
Messages = Daemon
Pool = Default
Schedule = "schedule1"
Storage = storage1
Client = "name1"
Fileset = "fileset2" <-- diff
Max Wait Time = 5m
Write Bootstrap = "/var/lib/bacula/name1-etc.bsr"
}