Module: FileProviderTestEvents

Defined in:
lib/test/test_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



67
68
69
70
71
# File 'lib/test/test_helper.rb', line 67

def self.extended(base)
  base.class.class_eval do
    alias_method :each_before_fpte, :each
  end
end

Instance Method Details

#after(p, f) ⇒ Object



96
97
98
99
100
101
# File 'lib/test/test_helper.rb', line 96

def after p, f
  return unless @on_before
  @on_after.each do |m|
    m.call p, f if m
  end
end

#before(p, f) ⇒ Object



89
90
91
92
93
94
# File 'lib/test/test_helper.rb', line 89

def before p, f
  return unless @on_before
  @on_before.each do |m|
    m.call p, f if m
  end
end

#eachObject



73
74
75
76
77
78
79
# File 'lib/test/test_helper.rb', line 73

def each
  each_before_fpte do |path, file|
    before path, file
    yield path, file
    after path, file
  end
end

#on_after(&block) ⇒ Object



85
86
87
# File 'lib/test/test_helper.rb', line 85

def on_after &block
  @on_after = [block]
end

#on_before(&block) ⇒ Object



81
82
83
# File 'lib/test/test_helper.rb', line 81

def on_before &block
  @on_before = [block]
end