Gabriel Lidenor Gabriel Lidenor - 1 year ago 92
Ruby Question

How do I compare two text files with rspec?

I have a method which compares if two text files have the same content.

How do I compare if two text files have the same content using rspec?

Answer Source

On a trivial level: ==

If you want to do something nicer, you're likely going to need to write a new matcher, something like have_same_content_as defined to check for the above condition. "Up and Running with Custom RSpec Matchers" is a nice tutorial on writing custom matchers.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download