Class: TurnipFormatter::Scenario::Base
- Inherits:
-
Object
- Object
- TurnipFormatter::Scenario::Base
- Defined in:
- lib/turnip_formatter/scenario/base.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#example ⇒ Object
readonly
Returns the value of attribute example.
Instance Method Summary collapse
- #feature_info ⇒ Object
- #feature_name ⇒ Object
- #id ⇒ Object
-
#initialize(example) ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ String
Scenario name.
-
#run_time ⇒ String
Scenario run time.
-
#status ⇒ String
Scenario status (‘passed’, ‘failed’ or ‘pending’).
- #steps ⇒ Object
- #tags ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(example) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# File 'lib/turnip_formatter/scenario/base.rb', line 11 def initialize(example) @example = example @errors = [] validation end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/turnip_formatter/scenario/base.rb', line 6 def errors @errors end |
#example ⇒ Object (readonly)
Returns the value of attribute example.
6 7 8 |
# File 'lib/turnip_formatter/scenario/base.rb', line 6 def example @example end |
Instance Method Details
#feature_info ⇒ Object
53 54 55 56 |
# File 'lib/turnip_formatter/scenario/base.rb', line 53 def feature_info path = RSpec::Core::Metadata.relative_path(feature_file_path) "\"#{feature_name}\" in #{path}" end |
#feature_name ⇒ Object
58 59 60 |
# File 'lib/turnip_formatter/scenario/base.rb', line 58 def feature_name parent_example_group[:description] end |
#id ⇒ Object
28 29 30 |
# File 'lib/turnip_formatter/scenario/base.rb', line 28 def id 'scenario_' + object_id.to_s end |
#name ⇒ String
Returns scenario name.
35 36 37 |
# File 'lib/turnip_formatter/scenario/base.rb', line 35 def name example.example_group.description end |
#run_time ⇒ String
Returns scenario run time.
49 50 51 |
# File 'lib/turnip_formatter/scenario/base.rb', line 49 def run_time execution_result.run_time end |
#status ⇒ String
Returns scenario status (‘passed’, ‘failed’ or ‘pending’).
42 43 44 |
# File 'lib/turnip_formatter/scenario/base.rb', line 42 def status execution_result.status.to_s end |
#steps ⇒ Object
22 23 24 25 26 |
# File 'lib/turnip_formatter/scenario/base.rb', line 22 def steps @steps ||= raw_steps.map do |step| TurnipFormatter::Step.new(example, step) end end |
#tags ⇒ Object
62 63 64 |
# File 'lib/turnip_formatter/scenario/base.rb', line 62 def example.[:turnip_formatter][:tags] end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/turnip_formatter/scenario/base.rb', line 18 def valid? errors.empty? end |