Class: Transpec::SpecSuite
- Inherits:
-
Object
- Object
- Transpec::SpecSuite
- Includes:
- Transpec::Syntax::Dispatcher
- Defined in:
- lib/transpec/spec_suite.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#runtime_data ⇒ Object
readonly
Returns the value of attribute runtime_data.
-
#target_paths ⇒ Object
readonly
Returns the value of attribute target_paths.
Instance Method Summary collapse
- #analyze ⇒ Object
-
#initialize(project = Project.new, target_paths = [], runtime_data = nil) ⇒ SpecSuite
constructor
A new instance of SpecSuite.
- #main_rspec_configure_node?(node) ⇒ Boolean
- #need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config? ⇒ Boolean
- #specs ⇒ Object
Methods included from Transpec::Syntax::Dispatcher
#dispatch_node, #dispatch_syntax, #handler_names, #invoke_handler
Constructor Details
#initialize(project = Project.new, target_paths = [], runtime_data = nil) ⇒ SpecSuite
Returns a new instance of SpecSuite.
15 16 17 18 19 20 |
# File 'lib/transpec/spec_suite.rb', line 15 def initialize(project = Project.new, target_paths = [], runtime_data = nil) @project = project @target_paths = target_paths @runtime_data = runtime_data @analyzed = false end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
13 14 15 |
# File 'lib/transpec/spec_suite.rb', line 13 def project @project end |
#runtime_data ⇒ Object (readonly)
Returns the value of attribute runtime_data.
13 14 15 |
# File 'lib/transpec/spec_suite.rb', line 13 def runtime_data @runtime_data end |
#target_paths ⇒ Object (readonly)
Returns the value of attribute target_paths.
13 14 15 |
# File 'lib/transpec/spec_suite.rb', line 13 def target_paths @target_paths end |
Instance Method Details
#analyze ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/transpec/spec_suite.rb', line 30 def analyze return if @analyzed specs.each do |spec| next unless spec.ast spec.ast.each_node do |node| dispatch_node(node, runtime_data, project) end end @analyzed = true end |
#main_rspec_configure_node?(node) ⇒ Boolean
48 49 50 51 52 53 54 55 56 |
# File 'lib/transpec/spec_suite.rb', line 48 def main_rspec_configure_node?(node) analyze if @main_rspec_configure @main_rspec_configure.node.equal?(node) else true end end |
#need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config? ⇒ Boolean
43 44 45 46 |
# File 'lib/transpec/spec_suite.rb', line 43 def need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config? analyze @need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config end |
#specs ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/transpec/spec_suite.rb', line 22 def specs @specs ||= Dir.chdir(project.path) do SpecFileFinder.find(target_paths).map do |path| ProcessedSource.from_file(path) end end end |