cukerail 0.6.2 → 0.6.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: ab0e9bf77e8c770d71213f34b24012e7a16c442b
4
- data.tar.gz: 9ff864386200a05132d7b256224d283fcb83a844
3
+ metadata.gz: 643c993ef00efc83f6faf698d87b02e2e73248d0
4
+ data.tar.gz: ef938045a98fffa050c180a9fcc6bd6549a41096
5
5
  SHA512:
6
- metadata.gz: dd003b53a3dd00f96a9fdb39495c9c6d97ea86ad24feace21ebc006c3fd6a15d49c9891ae16c1bf3e0cf5d2a3d7cb8ce6f84ed35f7ad19b5a4ba129ac7a2054c
7
- data.tar.gz: 31089ad0838cc34fa3b5fb770af29b5b6f1a2490ae0068b9a648839357ccf96451acb5dfd3c6efcbd129ac1906124c287c703496343260248319b786a44796cd
6
+ metadata.gz: 3f19cc78020397362517e49f5dff3fec52a7af543c3b01ab6cc764816d5b1e1ddd27066ddd7e23d13b2d94960a20f4ec2a3e69b5158f75f9ea2ca933d00d7e52
7
+ data.tar.gz: 9074945ac747956d7f3735808e7bb1cf76271e6cb74b997f9ea684fe41a590bc53177f049842e8e34f358b6ab93b3ee04c76261fbfc21a2e7f55110c24df1855
data/lib/cukerail/json.rb CHANGED
@@ -2,27 +2,6 @@ module Cukerail
2
2
  require 'cucumber/formatter/json'
3
3
  class Json < Cucumber::Formatter::Json
4
4
  class Cucumber::Formatter::Json::Builder
5
- def scenario_outline(scenario)
6
- # puts 'in scenario outline'
7
- @test_case_hash = {
8
- id: create_id(scenario) + ';' + (@example_id.gsub(' ','').gsub(',',';')),
9
- keyword: scenario.keyword,
10
- name: scenario.name + (ENV['OLD_STYLE_OUTLINE_NAMES'] ? ' :: ' : " ") + @example_id,
11
- description: scenario.description,
12
- line: @row.location.line,
13
- type: 'scenario'
14
- }
15
- tags = []
16
- tags += create_tags_array(scenario.tags) unless scenario.tags.empty?
17
- tags += @examples_table_tags if @examples_table_tags
18
- @test_case_hash[:tags] = tags unless tags.empty?
19
- comments = []
20
- comments += ::Cucumber::Formatter.create_comments_array(scenario.comments) unless scenario.comments.empty?
21
- comments += @examples_table_comments if @examples_table_comments
22
- comments += @row_comments if @row_comments
23
- @test_case_hash[:comments] = comments unless comments.empty?
24
- end
25
-
26
5
  def examples_table(examples_table)
27
6
  # puts 'in examples table'
28
7
  # We want the row data to be used in making the full scenario name
@@ -1,3 +1,3 @@
1
1
  module Cukerail
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
data/lib/json_sender.rb CHANGED
@@ -47,11 +47,28 @@ module Cukerail
47
47
 
48
48
  def get_name(scenario)
49
49
  base_name = scenario['name']
50
- outline_number_str = scenario['id'].split(';').select{|e| e =~/^\d+$/}.first
51
- if outline_number_str
52
- outline_number = (outline_number_str.to_i) -1
50
+ # We only extrapolate example data for scenario outlines
51
+ is_scenario_outline = scenario['keyword'].downcase == 'scenario outline' ? true : false
52
+ if is_scenario_outline
53
+ # if we have scenario number then we assume this is just a JSON output without our id patch
54
+ outline_number_str = scenario['id'].split(';').select{|e| e =~/^\d+$/}.first
55
+ if outline_number_str
56
+ outline_number = (outline_number_str.to_i) -1
57
+ else
58
+ # If we do not find an outline number, then we attempt to extrapolate the example data from the
59
+ # id if there is any and append to the base name. note: _ before variable means it is not going
60
+ # to be used
61
+ _feature, _scenario, example_data = scenario['id'].split(';')
62
+ unless example_data.nil? && example_data.strip.empty?
63
+ base_name = if ENV['OLD_STYLE_OUTLINE_NAMES']
64
+ "#{base_name} :: #{example_data}"
65
+ else
66
+ "#{base_name} #{example_data}"
67
+ end
68
+ end
69
+ end
53
70
  end
54
- tags= [scenario['tags']].flatten.compact
71
+ tags = [scenario['tags']].flatten.compact
55
72
  requirement = tags.select{|t| t['name'] =~/@req/}.map{|t| /@req_(\w+)/.match(t['name'])[1]}.first unless tags.empty?
56
73
  [requirement, base_name, outline_number].join(' ').strip
57
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukerail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Small
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber