Class: Spex::ModifiedCheck
- Defined in:
- lib/spex/checks/modified_check.rb
Overview
With no option, just verifies a change occurs
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods inherited from FileCheck
Methods inherited from Check
[], #active?, as, each, example, examples, #initialize, option, options, registry, #to_s, #validate!
Constructor Details
This class inherits a constructor from Spex::Check
Instance Method Details
#after ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spex/checks/modified_check.rb', line 28 def after assert File.exist?(target), "File does not exist at '#{target}'" checksum = current_checksum if active? assert_not_equal @before_checksum, checksum, "Checksum did not change" check_added_and_removed if [:added] || [:removed] else assert_equal @before_checksum, checksum, "Checksum changed" end end |
#before ⇒ Object
24 25 26 |
# File 'lib/spex/checks/modified_check.rb', line 24 def before assert File.exist?(target), "File does not exist at '#{target}'" end |
#prepare ⇒ Object
19 20 21 22 |
# File 'lib/spex/checks/modified_check.rb', line 19 def prepare track_checksum! track_contents! if [:added] || [:removed] end |