Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/torba-rb/assert_dirs_equal
Test expectation/assertion for directories equality
https://github.com/torba-rb/assert_dirs_equal
assertions minitest
Last synced: 3 days ago
JSON representation
Test expectation/assertion for directories equality
- Host: GitHub
- URL: https://github.com/torba-rb/assert_dirs_equal
- Owner: torba-rb
- License: mit
- Created: 2016-03-27T15:47:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-25T07:07:17.000Z (about 7 years ago)
- Last Synced: 2024-11-14T06:44:19.465Z (2 months ago)
- Topics: assertions, minitest
- Language: Ruby
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AssertDirsEqual
[![Build Status](https://img.shields.io/travis/torba-rb/assert_dirs_equal.svg)](https://travis-ci.org/torba-rb/assert_dirs_equal)
[![Gem version](https://img.shields.io/gem/v/assert_dirs_equal.svg)](https://rubygems.org/gems/assert_dirs_equal)**AssertDirsEqual** is a test framework-agnostic expectation/assertion for directories equality
by tree and content comparison.## Status
Production ready.
## Documentation
[Released version](http://rubydoc.info/gems/assert_dirs_equal/0.3.0)
## Why
Sometimes it is easier to commit expected directory structure and compare it with a directory
created by a method under test.If you prefer DSL-like expectations, see [minitest-filesystem][minitest-filesystem].
## Installation
Add this line to your application's Gemfile and run `bundle`:
```ruby
gem 'assert_dirs_equal', require: false
```
## Usage```ruby
class MyWriter
def self.perform
File.write("/tmp/my_writer/result.txt", "Hello world!")
end
end```
Create a file "result.txt" with "Hello world!" in "test/fixtures/case01".
### Minitest
```ruby
require 'minitest/assert_dirs_equal'class MyWriterTest < Minitest::Test
def test_perform
MyWriter.perform
assert_dirs_equal "test/fixtures/case01", "/tmp/my_writer"
end
end
```### RSpec
TODO
## Known issues
Due that Rubinius String#strip doesn't fail on binary data (undocumented behaviour), the library will
try to actually diff binary files. Depending on your test framework's diffing tool, it may or may not
be a problem. For example, Minitest is not affected, since it uses shell `diff` under the hood.## Origin
Extracted from [Torba][torba-github] library since it looks more like a standalone component.
[minitest-filesystem]: https://github.com/stefanozanella/minitest-filesystem
[torba-github]: https://github.com/torba-rb/torba