-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtest_helper.rb
More file actions
32 lines (28 loc) · 854 Bytes
/
test_helper.rb
File metadata and controls
32 lines (28 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "openscap_results_parser"
require 'pathname'
require "minitest/autorun"
require 'shoulda-context'
require 'mocha/minitest'
def test(name, &block)
test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
defined = method_defined? test_name
raise "#{test_name} is already defined in #{self}" if defined
if block_given?
define_method(test_name, &block)
else
define_method(test_name) do
flunk "No implementation provided for #{name}"
end
end
end
def file_fixture(fixture_name)
file_fixture_path = './test/fixtures/files'
path = Pathname.new(File.join(file_fixture_path, fixture_name))
if path.exist?
path
else
msg = "the directory '%s' does not contain a file named '%s'"
raise ArgumentError, msg % [file_fixture_path, fixture_name]
end
end