ruby - How do I compare two text files with rspec? -
i have method compares if 2 text files have same content.
how compare if 2 text files have same content using rspec?
on trivial level:
io.read(file1).should == io.read(file2)
if want nicer, you're going need write new matcher, have_same_content_as
defined check above condition. "up , running custom rspec matchers" nice tutorial on writing custom matchers.
Comments
Post a Comment