Class: Spex::CreatedCheck

Inherits:
FileCheck show all
Defined in:
lib/spex/checks/created_check.rb

Instance Attribute Summary

Attributes inherited from Check

#options, #target

Instance Method Summary collapse

Methods inherited from FileCheck

#kind, #kind_name

Methods inherited from Check

[], #active?, as, each, example, examples, #initialize, option, options, #prepare, registry, #to_s, #validate!

Constructor Details

This class inherits a constructor from Spex::Check

Instance Method Details

#afterObject



16
17
18
19
20
21
22
23
# File 'lib/spex/checks/created_check.rb', line 16

def after
  if active?
    assert File.exist?(target), "File was not created at #{target}"
    check_type
  else
    assert !File.exist?(target), "File was created at #{target}"        
  end
end

#beforeObject



10
11
12
13
14
# File 'lib/spex/checks/created_check.rb', line 10

def before
  if active?
    assert !File.exist?(target), "File already exists at #{target}"
  end
end