Class: BaseTest
- Defined in:
- lib/test/test_helper.rb
Instance Method Summary collapse
- #add_file_events ⇒ Object
- #fp(path) ⇒ Object
- #new_files(files) ⇒ Object
- #r(action, name = :rename_replace, expected_yields = nil, options = {}) ⇒ Object
- #setup ⇒ Object
- #test_shutup ⇒ Object
Instance Method Details
#add_file_events ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/test/test_helper.rb', line 116 def add_file_events @files.extend FileProviderTestEvents @files.on_before do |p, f| @path = p @file = f @full_name = fp File.join(p, f) end end |
#fp(path) ⇒ Object
125 126 127 |
# File 'lib/test/test_helper.rb', line 125 def fp(path) File. path end |
#new_files(files) ⇒ Object
111 112 113 114 |
# File 'lib/test/test_helper.rb', line 111 def new_files(files) @files = Provider::File::Array.new(files) add_file_events end |
#r(action, name = :rename_replace, expected_yields = nil, options = {}) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/test/test_helper.rb', line 131 def r(action, name = :rename_replace, expected_yields = nil, = {}) [:file_provider] ||= @files [:action] ||= action [:filter] = Filter.add [:filter], Filter.new(/^\.+$/) unless [:test_r_nofilter] yc = 0 @r.run name, do |h| yc += 1 yield h if block_given? end if [:test_r_count] raise 'exception raised' if expected_yields and expected_yields != yc else assert_equal expected_yields, yc, 'Expected yields from renamer' if expected_yields end end |
#setup ⇒ Object
106 107 108 109 |
# File 'lib/test/test_helper.rb', line 106 def setup new_files( %w{ dir/. dir/.. dir/file1 dir/file2 dir/file3 } ) @r = RenamerMock.new end |
#test_shutup ⇒ Object
129 |
# File 'lib/test/test_helper.rb', line 129 def test_shutup; end |