Module: TestParser
- Extended by:
- TestParser
- Included in:
- TestParser
- Defined in:
- lib/test_parser.rb,
lib/test_parser/snippet.rb,
lib/test_parser/version.rb,
lib/test_parser/source_code.rb,
lib/test_parser/command_line.rb,
lib/test_parser/parser/rspec.rb,
lib/test_parser/parser/common.rb,
lib/test_parser/parser/minitest.rb,
lib/test_parser/test_information.rb,
lib/test_parser/snippet_source/common.rb,
lib/test_parser/snippet_source/method.rb,
lib/test_parser/snippet_source/line_number.rb
Defined Under Namespace
Modules: Parser, SnippetSource
Classes: CommandLine, Snippet, SourceCode, TestInformation
Constant Summary
collapse
- DEFAULT_PARSERS =
[Parser::MiniTest, Parser::RSpec]
- VERSION =
"0.0.4"
- SourceCodeError =
Class.new(StandardError)
- NoMethodFoundError =
Class.new(SourceCodeError)
- NoCodeInLineError =
Class.new(SourceCodeError)
Instance Method Summary
collapse
Instance Method Details
#all_tests(path, options = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/test_parser.rb', line 9
def all_tests(path, options = {})
parsers = options[:parsers] ||= DEFAULT_PARSERS
path = sanitize_path(path)
libs = options[:libs] || []
libs << 'spec'
add_libs_to_load_path(path, libs)
parsers.collect_concat do |parser|
parser.find_tests(path, options[parser.type] || {})
end
end
|
#require_all(path, glob) ⇒ Object
22
23
24
|
# File 'lib/test_parser.rb', line 22
def require_all(path, glob)
Dir[sanitize_path(path) + glob].each {|f| require f }
end
|
#sanitize_path(path) ⇒ Object
26
27
28
29
30
|
# File 'lib/test_parser.rb', line 26
def sanitize_path(path)
return path if path.is_a? Pathname
Pathname.new(path).expand_path
end
|