Class: CucumberJunitToJson::FeatureJsonBuilder
- Inherits:
-
Object
- Object
- CucumberJunitToJson::FeatureJsonBuilder
- Defined in:
- lib/cucumber_junit_to_json/feature_json_builder.rb
Overview
Uses JBuilder to model a JSON feature object
Instance Attribute Summary collapse
-
#feature_json ⇒ Object
Returns the value of attribute feature_json.
Instance Method Summary collapse
-
#initialize(feature) ⇒ FeatureJsonBuilder
constructor
A new instance of FeatureJsonBuilder.
Constructor Details
#initialize(feature) ⇒ FeatureJsonBuilder
Returns a new instance of FeatureJsonBuilder.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cucumber_junit_to_json/feature_json_builder.rb', line 9 def initialize(feature) @feature_json = Jbuilder.encode do |json| json.keyword feature.keyword json.name feature.name json. feature. do |tag| json.name tag.name json.line tag.line end json.elements feature.elements do |scenario| json.type scenario.type json.keyword scenario.keyword json.name scenario.name json. scenario. do |tag| json.name tag.name json.line tag.line end json.steps scenario.steps do |step| json.keyword step.keyword json.name step.name json.match do json.location step.match.location json.arguments step.match.arguments end json.result do json.status step.result.status json.duration step.result.duration if step.result. json. step.result. end end unless step.table.headings.size.zero? json.table do json.headings step.table.headings json.rows step.table.rows end json.rows step.rows do |row| json.cells row.cells json.line row.line end end json.line step.line end json.line scenario.line json.uri scenario.uri json.description scenario.description json.id scenario.id end json.description feature.description json.line feature.line json.uri feature.uri json.id feature.id end end |
Instance Attribute Details
#feature_json ⇒ Object
Returns the value of attribute feature_json.
8 9 10 |
# File 'lib/cucumber_junit_to_json/feature_json_builder.rb', line 8 def feature_json @feature_json end |