Matcher for testing file content

Hi.

Is there any matcher for test file content, anything like

file("/path/to/file.txt").should contain(“File content”)
or
file("/path/to/file.txt").content.should == “File content”
or
file_content("/path/to/file.txt").should == “File content”

or something else?

Jarl

On Tue, Dec 20, 2011 at 5:51 AM, Jarl F. [email protected] wrote:

or something else?

File.read(“/path/to/file”) will give you a string of the entire
contents of the file.

File.read(“/path/to/file”).should match “content”
File.read(“/path/to/file”).should include “content”

etc.

Does that help?

Best,
Michael G.

Yes, that certainly did the trick…
I use

File.read(“/path/to/file”).should == “content”

Thanks.

2011/12/20 Michael G. [email protected]:

Does that help?

Best,
Michael G.


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users


Jarl F.
Softace ApS
Rådhustorvet 7, 2.
3520 Farum
LinkedIn: http://dk.linkedin.com/in/jarlfriis