Class: Cyperful::TestParser
- Inherits:
-
Object
- Object
- Cyperful::TestParser
- Defined in:
- lib/cyperful/test_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(test_class) ⇒ TestParser
constructor
A new instance of TestParser.
- #steps_per_test ⇒ Object
Constructor Details
#initialize(test_class) ⇒ TestParser
Returns a new instance of TestParser.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cyperful/test_parser.rb', line 39 def initialize(test_class) @test_class = test_class @source_filepath = if Cyperful.rspec? test_class..fetch(:absolute_file_path) else Object.const_source_location(test_class.name).first end end |
Class Method Details
.add_step_at_methods(*mods_or_methods) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cyperful/test_parser.rb', line 25 def self.add_step_at_methods(*mods_or_methods) mods_or_methods.flatten.each do |mod_or_method| case mod_or_method when Module @step_at_methods += mod_or_method.methods(false) + mod_or_method.instance_methods(false) when String, Symbol @step_at_methods << mod_or_method.to_sym else raise "Expected Module or string/symbol, got: #{mod_or_method.class.name}" end end end |
.step_at_methods_set ⇒ Object
22 23 24 |
# File 'lib/cyperful/test_parser.rb', line 22 def self.step_at_methods_set @step_at_methods_set ||= @step_at_methods.to_set end |
Instance Method Details
#steps_per_test ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cyperful/test_parser.rb', line 50 def steps_per_test case Cyperful.test_framework when :rspec rspec_steps_per_test when :minitest minitest_steps_per_test else raise "Unsupported test framework: #{Cyperful.test_framework}" end end |