cucumber_junit_to_json 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 5f5bf62aa225372ebdd3280e7b7b0df64f7cd211
4
- data.tar.gz: 7252a9b1fed4ac301b32eb176ba4fee9ca54cf80
3
+ metadata.gz: aeec7ff6a8e9c51701503f9f4f9d8cfca47a8f46
4
+ data.tar.gz: fd60019eb42a76e83fcbd4af4d72ac57617083e7
5
5
  SHA512:
6
- metadata.gz: b54d8386a4b28609357271e6632e51a89398ebccb0f0397818a634511a384a6839ab4fdc90143f6c799e81628c0ee9f3be78db884af0de62b2e47699b72452b2
7
- data.tar.gz: 9b0c84d2486ad741f91c08482f504bb4dbcba2d06e81f15ee564f7429bd69ec071beb0e02533923f7e42e90f0bb863561eb0953439dcc49076c89777293d41b6
6
+ metadata.gz: eb8b7191931ef0cb73ee20d7cbae276189414b3fc8dff6a8d05f0b4c0132995f13e51b27dded5bf85211abebb87347d9973973f7a248af7e31111c227b850a96
7
+ data.tar.gz: 8ccd726ef10fddea9c687ad7a5ae6596df7ca70fec763ef35c4cf6aec7c3df59674c949080604482db7d773f46527fee6023a384ef3d8e4383a09498412ff321
@@ -35,7 +35,6 @@ module CucumberJunitToJson
35
35
  @feature_parser = CucumberJunitToJson::Parsers::FeatureParser.new(options.feature_dir)
36
36
  output_file = options.output_file || 'cucumber.json'
37
37
  features = []
38
- puts output_file
39
38
  unless File.file?(output_file)
40
39
  output_directory = File.dirname(output_file)
41
40
  FileUtils.mkdir_p(output_directory) unless File.directory?(output_directory)
@@ -82,8 +81,8 @@ module CucumberJunitToJson
82
81
  scenario = CucumberJunitToJson::Models::Scenario.new
83
82
  # Removing scenario outline added blob gives you the actual scenario name
84
83
  scenario.name = testcase['name'].split('-- @').first.strip
85
- scenario.tags, scenario.line = @feature_parser.tags_and_line_number_matching(feature_uri, scenario.name, true)
86
- scenario_line_text = @feature_parser.text_and_line_number_matching(feature_uri, scenario.name, true).first
84
+ scenario.tags, scenario.line = @feature_parser.tags_and_line_number_matching(feature_uri, scenario.name)
85
+ scenario_line_text = @feature_parser.text_and_line_number_matching(feature_uri, scenario.name).first
87
86
  scenario.keyword = scenario_line_text.split(':').first.strip
88
87
  scenario.type = 'scenario'
89
88
  scenario.uri = feature_uri
@@ -68,7 +68,7 @@ module CucumberJunitToJson
68
68
  if line =~ /<\S+>/
69
69
  # A match percentage greater than 80 is an indication
70
70
  # of a good match for scenarios
71
- found_scenario = true if line.similar(scenario) >= 80
71
+ found_scenario = true if line.similar(scenario) >= 76
72
72
  elsif line =~ /#{scenario}/
73
73
  found_scenario = true
74
74
  end
@@ -17,8 +17,8 @@ module CucumberJunitToJson
17
17
  @path_to_features = path_to_features
18
18
  end
19
19
 
20
- def tags_and_line_number_matching(file, text, partial_match = false)
21
- tags, line = text_and_line_number_before_match(file, text, partial_match)
20
+ def tags_and_line_number_matching(file, text)
21
+ tags, line = text_and_line_number_before_match(file, text)
22
22
  tag_objects = []
23
23
  tags.split(' ').each do |tag|
24
24
  if tag.strip.start_with?('@')
@@ -28,14 +28,14 @@ module CucumberJunitToJson
28
28
  [tag_objects, line]
29
29
  end
30
30
 
31
- def text_and_line_number_before_match(file, text, partial_match = false)
31
+ def text_and_line_number_before_match(file, text)
32
32
  count = 0
33
33
  prev_line_text = ''
34
34
  File.open(file, 'r') do |f|
35
35
  f.each_line do |line|
36
36
  count += 1
37
- if partial_match == true
38
- return prev_line_text, count if line.similar(text) >= 80
37
+ if line =~ /<\S+>/
38
+ return prev_line_text, count if line.similar(text) >= 76
39
39
  elsif line =~ /#{text}/
40
40
  return prev_line_text, count
41
41
  end
@@ -45,13 +45,13 @@ module CucumberJunitToJson
45
45
  raise Error, "Could not find #{text} in #{file}"
46
46
  end
47
47
 
48
- def text_and_line_number_matching(file, text, partial_match = false)
48
+ def text_and_line_number_matching(file, text)
49
49
  count = 0
50
50
  File.open(file, 'r') do |f|
51
51
  f.each_line do |line|
52
52
  count += 1
53
- if partial_match == true
54
- return line, count if line.similar(text) >= 80
53
+ if line =~ /<\S+>/
54
+ return line, count if line.similar(text) >= 76
55
55
  elsif line =~ /#{text}/
56
56
  return line, count
57
57
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Cucumber Junit to Json version module
4
4
  module CucumberJunitToJson
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_junit_to_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Voke Ransom Anighoro