Class: Cucumber::Formatter::Json::Builder
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb
Instance Attribute Summary collapse
-
#background_hash ⇒ Object
readonly
Returns the value of attribute background_hash.
-
#feature_hash ⇒ Object
readonly
Returns the value of attribute feature_hash.
-
#test_case_hash ⇒ Object
readonly
Returns the value of attribute test_case_hash.
Instance Method Summary collapse
- #background(background) ⇒ Object
- #background? ⇒ Boolean
- #feature(feature, uri) ⇒ Object
-
#initialize(test_case, ast_lookup) ⇒ Builder
constructor
A new instance of Builder.
- #scenario(scenario_source, test_case) ⇒ Object
Constructor Details
#initialize(test_case, ast_lookup) ⇒ Builder
Returns a new instance of Builder.
240 241 242 243 244 245 246 247 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 240 def initialize(test_case, ast_lookup) @background_hash = nil uri = test_case.location.file feature = ast_lookup.gherkin_document(uri).feature feature(feature, uri) background(feature.children.first.background) unless feature.children.first.background.nil? scenario(ast_lookup.scenario_source(test_case), test_case) end |
Instance Attribute Details
#background_hash ⇒ Object (readonly)
Returns the value of attribute background_hash.
238 239 240 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 238 def background_hash @background_hash end |
#feature_hash ⇒ Object (readonly)
Returns the value of attribute feature_hash.
238 239 240 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 238 def feature_hash @feature_hash end |
#test_case_hash ⇒ Object (readonly)
Returns the value of attribute test_case_hash.
238 239 240 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 238 def test_case_hash @test_case_hash end |
Instance Method Details
#background(background) ⇒ Object
267 268 269 270 271 272 273 274 275 276 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 267 def background(background) @background_hash = { keyword: background.keyword, name: background.name, description: value_or_empty_string(background.description), line: background.location.line, type: 'background', steps: [] } end |
#background? ⇒ Boolean
249 250 251 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 249 def background? @background_hash != nil end |
#feature(feature, uri) ⇒ Object
253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 253 def feature(feature, uri) @feature_hash = { id: create_id(feature.name), uri: uri, keyword: feature.keyword, name: feature.name, description: value_or_empty_string(feature.description), line: feature.location.line } return if feature..empty? @feature_hash[:tags] = (feature.) end |
#scenario(scenario_source, test_case) ⇒ Object
278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/json.rb', line 278 def scenario(scenario_source, test_case) scenario = scenario_source.type == :Scenario ? scenario_source.scenario : scenario_source.scenario_outline @test_case_hash = { id: "#{@feature_hash[:id]};#{create_id_from_scenario_source(scenario_source)}", keyword: scenario.keyword, name: test_case.name, description: value_or_empty_string(scenario.description), line: test_case.location.lines.max, type: 'scenario', steps: [] } @test_case_hash[:tags] = (test_case.) unless test_case..empty? end |