cukerail 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 643c993ef00efc83f6faf698d87b02e2e73248d0
4
- data.tar.gz: ef938045a98fffa050c180a9fcc6bd6549a41096
3
+ metadata.gz: acbe632026d6a5cd33ee306e3945632d4d6dbd36
4
+ data.tar.gz: 6e77965518ae731c673d8ed1448b96ea9716700f
5
5
  SHA512:
6
- metadata.gz: 3f19cc78020397362517e49f5dff3fec52a7af543c3b01ab6cc764816d5b1e1ddd27066ddd7e23d13b2d94960a20f4ec2a3e69b5158f75f9ea2ca933d00d7e52
7
- data.tar.gz: 9074945ac747956d7f3735808e7bb1cf76271e6cb74b997f9ea684fe41a590bc53177f049842e8e34f358b6ab93b3ee04c76261fbfc21a2e7f55110c24df1855
6
+ metadata.gz: cd9cb997cef8ea267464400419803a777dee9c2c1dedf7f9e25ac2c2322aa4a0e15e12c3b3d35691d0b5358c00636287f5c44771145ed134e2c61df20cadbbc0
7
+ data.tar.gz: 491648c6ed448ef4f51fa15d183d2336a50efb433f6a64c2c215b3f19e0959753944182567f224a74864e8eeedeebf0f9ca9a3ed4ee8c4c38550f64535c336dc
data/.gitignore CHANGED
@@ -21,4 +21,5 @@ tmp
21
21
  *.a
22
22
  mkmf.log
23
23
  *.swp
24
+ .byebug_history
24
25
 
@@ -1,3 +1,3 @@
1
1
  module Cukerail
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
data/lib/cukerail.rb CHANGED
@@ -62,16 +62,17 @@ module Cukerail
62
62
  if tagged_id
63
63
  result = /testcase_(\d+)/.match(tagged_id.name)[1]
64
64
  else
65
- tags = all_tags(test_case)
66
- project_id = /\d+/.match(tags.select{|tag| tag.name =~/project/}.first.name)[0]
67
- suite_id = /\d+/.match(tags.select{|tag| tag.name =~/suite/}.first.name)[0]
65
+ tags = test_case.tags
66
+ project_id = /\d+/.match(tags.select{|tag| tag.name =~/project/}.last.name)[0]
67
+ suite_id = /\d+/.match(tags.select{|tag| tag.name =~/suite/}.last.name)[0]
68
+ section_id = /\d+/.match(tags.select{|tag| tag.name =~/sub_section/}.last.name)[0]
69
+ puts section_id
68
70
  title = extract_title(test_case)
69
- found_case = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}").select{|c| c['title'] == title}.first
71
+ found_case = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}&section_id=#{section_id}").select{|c| c['title'] == title}.first
70
72
  if found_case
71
73
  result= found_case['id']
72
74
  else
73
- sub_section_id = /\d+/.match(tags.select{|tag| tag.name =~/sub_section/}.first.name)[0]
74
- result = create_new_case(project_id,suite_id,sub_section_id,test_case)['id']
75
+ result = create_new_case(project_id,suite_id,section_id,test_case)['id']
75
76
  end
76
77
  end
77
78
  return result
data/lib/json_sender.rb CHANGED
@@ -25,11 +25,17 @@ module Cukerail
25
25
 
26
26
  def get_id(scenario,background_steps,project_id,suite_id,sub_section_id)
27
27
  title = get_name(scenario)
28
- found_case = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}").select{|c| c['title'] == title}.first
28
+ scenario_level_sub_section = scenario['tags'].select{|j| j['name']=~/sub_section_\d+/}.last
29
+ if scenario_level_sub_section
30
+ sub_section_id_override = /sub_section_(\d+)/.match(scenario_level_sub_section['name'])[1]
31
+ else
32
+ sub_section_id_override=sub_section_id
33
+ end
34
+ found_case = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}&section_id=#{sub_section_id_override}").select{|c| c['title'] == title}.first
29
35
  if found_case
30
36
  result= found_case['id']
31
37
  else
32
- test_case = create_new_case(scenario,background_steps,project_id,suite_id,sub_section_id)
38
+ test_case = create_new_case(scenario,background_steps,project_id,suite_id,sub_section_id_override)
33
39
  result = test_case ? test_case['id'] : nil
34
40
  end
35
41
  return result
@@ -105,17 +111,17 @@ module Cukerail
105
111
  end
106
112
 
107
113
  def defects(scenario)
108
- if scenario['tags']
109
- tags= [scenario['tags']].flatten.compact
110
- tags.select{|tag| tag['name'] =~/(?:jira|defect)_/}.map{|ticket| /(?:jira|defect)_(\w+-\d+)$/.match(ticket['name'])[1]}.uniq.join(",")
111
- end
114
+ if scenario['tags']
115
+ tags = [scenario['tags']].flatten.compact
116
+ tags.select{|tag| tag['name'] =~/(?:jira|defect)_/}.map{|ticket| /(?:jira|defect)_(\w+-\d+)$/.match(ticket['name'])[1]}.uniq.join(",")
117
+ end
112
118
  end
113
119
 
114
120
  def refs(scenario)
115
- if scenario['tags']
116
- tags= [scenario['tags']].flatten.compact
117
- tags.select{|tag| tag['name'] =~/(?:jira|ref)_/}.map{|ticket| /(?:jira|ref)_(\w+-\d+)$/.match(ticket['name'])[1]}.uniq.join(",")
118
- end
121
+ if scenario['tags']
122
+ tags = [scenario['tags']].flatten.compact
123
+ tags.select{|tag| tag['name'] =~/(?:jira|ref)_/}.map{|ticket| /(?:jira|ref)_(\w+-\d+)$/.match(ticket['name'])[1]}.uniq.join(",")
124
+ end
119
125
  end
120
126
 
121
127
  def send_result(scenario,id,run_id)
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.3
4
+ version: 0.6.4
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-30 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber