Class: AssertDirsEqual::Matcher
- Inherits:
-
Object
- Object
- AssertDirsEqual::Matcher
- Defined in:
- lib/assert_dirs_equal/matcher.rb
Overview
Confirms with RSpec3 custom matcher protocol.
Instance Attribute Summary collapse
- #failure_message ⇒ String readonly
Instance Method Summary collapse
- #failure_message_when_negated ⇒ Object
-
#initialize(expected, options = {}) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(target) ⇒ true, false
Constructor Details
#initialize(expected, options = {}) ⇒ Matcher
Returns a new instance of Matcher.
21 22 23 24 |
# File 'lib/assert_dirs_equal/matcher.rb', line 21 def initialize(expected, = {}) @expected = expected @exact_match = .fetch(:exact_match, true) end |
Instance Attribute Details
#failure_message ⇒ String (readonly)
15 16 17 |
# File 'lib/assert_dirs_equal/matcher.rb', line 15 def end |
Instance Method Details
#failure_message_when_negated ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/assert_dirs_equal/matcher.rb', line 42 def if @exact_match "expected #{@target.inspect} to not be equal to #{@expected.inspect}, but they are equal" else "expected files from #{@target.inspect} to not be present in #{@expected.inspect}, but they are" end end |
#matches?(target) ⇒ true, false
32 33 34 35 36 37 38 |
# File 'lib/assert_dirs_equal/matcher.rb', line 32 def matches?(target) @target = target assert_exists(@expected) && assert_exists(@target) && assert_directory(@expected) && assert_directory(@target) && assert_target_contains_all_expected_entries && refute_extra_files_in_target end |