Module: FileProviderTestEvents

Defined in:
lib/test/test_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



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

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

Instance Method Details

#after(p, f) ⇒ Object



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

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



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

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

#eachObject



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

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

#on_after(&block) ⇒ Object



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

def on_after &block
  @on_after = [block]
end

#on_before(&block) ⇒ Object



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

def on_before &block
  @on_before = [block]
end