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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -