Class: TestParser::Parser::RSpec
- Inherits:
-
Object
- Object
- TestParser::Parser::RSpec
show all
- Includes:
- Common
- Defined in:
- lib/test_parser/parser/rspec.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Common
#build_test, #parser_type
Constructor Details
#initialize(example) ⇒ RSpec
Returns a new instance of RSpec.
34
35
36
|
# File 'lib/test_parser/parser/rspec.rb', line 34
def initialize(example)
@example = example
end
|
Instance Attribute Details
#example ⇒ Object
Returns the value of attribute example.
11
12
13
|
# File 'lib/test_parser/parser/rspec.rb', line 11
def example
@example
end
|
Class Method Details
.find_tests(path, options = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/test_parser/parser/rspec.rb', line 17
def self.find_tests(path, options = {})
glob = options[:glob] || 'spec/**/*_spec.rb'
::RSpec.with_world ::RSpec::Core::World.new do |world|
TestParser.require_all(path, glob)
groups = world.example_groups
examples = groups.collect_concat(&:descendant_filtered_examples)
examples.map do |example|
new(example).build_test
end
end
end
|
.type ⇒ Object
13
14
15
|
# File 'lib/test_parser/parser/rspec.rb', line 13
def self.type
:rspec2
end
|
Instance Method Details
#file_name ⇒ Object
50
51
52
|
# File 'lib/test_parser/parser/rspec.rb', line 50
def file_name
example.file_path
end
|
#identification ⇒ Object
38
39
40
|
# File 'lib/test_parser/parser/rspec.rb', line 38
def identification
@identification ||= path_to_example.join('/')
end
|
#line_number ⇒ Object
54
55
56
|
# File 'lib/test_parser/parser/rspec.rb', line 54
def line_number
example.metadata[:line_number]
end
|
#snippet ⇒ Object
46
47
48
|
# File 'lib/test_parser/parser/rspec.rb', line 46
def snippet
@snippet ||= snippet_source.snippet
end
|
#snippet_source ⇒ Object
42
43
44
|
# File 'lib/test_parser/parser/rspec.rb', line 42
def snippet_source
@snippet_source ||= SnippetSource::LineNumber.new(file_name, line_number)
end
|