Minitest::Filesystem
Adds assertions and expectations to check filesystem content in a communicative way.
Installation
Add this line to your application's Gemfile:
gem 'minitest-filesystem'
And then execute:
$ bundle
Or install it yourself as:
$ gem install minitest-filesystem
Once the gem is installed, just add this line to your test_helper.rb:
require 'minitest/filesystem'
Usage
Let's suppose the following filesystem structure exists:
root_dir/file_1file_2subdir_1/subfile_1subfile_2subsubdir_1/
subdir_2/
You can check if root_dir contains a specific structure:
assert_contains_filesystem("root_dir") do
file "file_1"
dir "subdir_1" do
file "subfile_1"
end
dir "subdir_2"
end
or, if you prefer the expectation style:
filesystem {
file "file_1"
dir "subdir_1" do
file "subfile_1"
end
dir "subdir_2"
}.must_exist_within "root_dir"
Note that the match need not to be exact (i.e. there can be other files and
directories inside root_dir that the matcher won't care about).
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Changelog
0.0.1
- Extract assertion and matcher from current projects
0.1.0
- Refactor existing code
- Add more tests around assertion
- Infect
must_exist_withinexpectation
1.0.0
- Add support for Ruby 1.8.



