air_test 0.1.5.0 → 0.1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b19be078019395eb0f510f9f96d0acb563f45dddfce668d27ed1194d1c2302e
4
- data.tar.gz: 1fb2a90ce3c6581dc5a77fdf23e71d2f0474fec361faf999960a41e92a31c77a
3
+ metadata.gz: f817f7224c6f3bc2bc49607ce00e9e069701e85c2bfeab3015aff5795ce0767b
4
+ data.tar.gz: a79251b05748bdf35a4b9befaea87bdb9bf3271d4eafaded2e14403911dd3a0a
5
5
  SHA512:
6
- metadata.gz: 2cc0278ea9d903ce627c1afb64cc052c535900ab371d3b97a3e69e684135b4fbd52adde2e86c33750bc66377b2c8d3c9f63186d77f5eab478c14b42c3838ed5f
7
- data.tar.gz: dfd2c4ad5a70b20c981b961c28e6f09506c6e4ce1176ab6a7296bd52dffa33a01a165e8b38f16724d4c0709753452f5cc7f2751344bc5f381575d47a1a3fef3e
6
+ metadata.gz: 1befd0f3de325c240a0299a99ffb1e359282d57e36c1f713a2bef8d7fe1ff2ac927deb183e3dcfb23aab362a63eddb3b5eaa1207c8b7bbe6ec796e043c3e3875
7
+ data.tar.gz: 0246d8260912850bec3d9ca8391a1441bf964a92ff343b4fc5d12224f3923c883ac07bd1bcb97edbf3ae8e3d372bc508b266c19072361a38f0420ad5b0ee5901
@@ -81,7 +81,8 @@ module AirTest
81
81
  current_scenario = nil
82
82
  in_feature_block = false
83
83
  in_scenario_block = false
84
- last_block_type = nil
84
+ in_background_block = false
85
+ background_steps = []
85
86
  blocks.each_with_index do |block, idx|
86
87
  case block["type"]
87
88
  when "heading_1", "heading_2", "heading_3"
@@ -89,15 +90,22 @@ module AirTest
89
90
  if heading_text.downcase.include?("feature")
90
91
  in_feature_block = true
91
92
  in_scenario_block = false
93
+ in_background_block = false
92
94
  parsed_data[:feature] = heading_text
95
+ elsif heading_text.strip.downcase == "background:"
96
+ in_background_block = true
97
+ in_feature_block = false
98
+ in_scenario_block = false
93
99
  elsif heading_text.downcase.include?("scenario")
94
100
  in_scenario_block = true
95
101
  in_feature_block = false
102
+ in_background_block = false
96
103
  current_scenario = { title: heading_text, steps: [] }
97
104
  parsed_data[:scenarios] << current_scenario
98
105
  else
99
106
  in_feature_block = false
100
107
  in_scenario_block = false
108
+ in_background_block = false
101
109
  end
102
110
  when "paragraph"
103
111
  text = extract_text(block["paragraph"]["rich_text"])
@@ -105,6 +113,8 @@ module AirTest
105
113
 
106
114
  if in_feature_block
107
115
  parsed_data[:feature] += "\n#{text}"
116
+ elsif in_background_block
117
+ background_steps << text
108
118
  elsif in_scenario_block && current_scenario
109
119
  current_scenario[:steps] << text
110
120
  end
@@ -114,6 +124,8 @@ module AirTest
114
124
 
115
125
  if in_feature_block
116
126
  parsed_data[:feature] += "\n• #{text}"
127
+ elsif in_background_block
128
+ background_steps << text
117
129
  elsif in_scenario_block && current_scenario
118
130
  current_scenario[:steps] << text
119
131
  end
@@ -132,7 +144,12 @@ module AirTest
132
144
  parsed_data[:meta][:assignee] = extract_assignee(text)
133
145
  end
134
146
  end
135
- last_block_type = block["type"]
147
+ end
148
+ # Prepend background steps to each scenario
149
+ if background_steps.any?
150
+ parsed_data[:scenarios].each do |scenario|
151
+ scenario[:steps] = background_steps + scenario[:steps]
152
+ end
136
153
  end
137
154
  # Handle case where there is only one scenario and no explicit scenario heading
138
155
  if parsed_data[:scenarios].empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AirTest
4
- VERSION = "0.1.5.0"
4
+ VERSION = "0.1.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.0
4
+ version: 0.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - julien bouland