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 - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -