No commit activity in last 3 years
No release in over 3 years
Test assertion for directories equality by tree and content comparison
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 5.4
~> 10.0
 Project Readme

AssertDirsEqual

Build Status Gem version

AssertDirsEqual is a test framework-agnostic expectation/assertion for directories equality by tree and content comparison.

Status

Production ready.

Documentation

Released version

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.

Installation

Add this line to your application's Gemfile and run bundle:

gem 'assert_dirs_equal', require: false

Usage

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

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 library since it looks more like a standalone component.