How to test obtaining a list of files within a directory using RSpec?

Posted by John Topley on Stack Overflow See other posts from Stack Overflow or by John Topley
Published on 2010-05-18T07:25:47Z Indexed on 2010/05/18 7:40 UTC
Read the original article Hit count: 168

Filed under:
|

I'm pretty new to the world of RSpec. I'm writing a RubyGem that deals with a list of files within a specified directory and any sub-directories. Specifically, it will use Find.find and append the files to an Array for later output.

I'd like to write a spec to test this behaviour but don't really know where to start in terms of faking a directory of files and stubbing Find.find etc. This is what little I have so far:

it "should return a list of files within the specified directory" do
end

Any help much appreciated!

© Stack Overflow or respective owner

Related posts about rspec

Related posts about ruby