testrail-rspec 0.1.5 → 0.1.6

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: 1c70ba423972b92769646ae9cc25f9defea53cb5900d84404df61182866d21c9
4
- data.tar.gz: 8e6d73a47e9af513521de1b4903914eb99c5fab8c262f01a14bb0bdb1c1778b4
3
+ metadata.gz: 9490b35d242306d46791f6223e3725a384ddba101b447b99bc38509c9e7dbf7f
4
+ data.tar.gz: f16d170284957455c2210f0b73717c077e6cb9d915f2581122076e723ea683fc
5
5
  SHA512:
6
- metadata.gz: b72657f0b80dafb37a0c7e2a126ab31f839f5e9e2ac0c27cacc3e3250fcdd6709d81fc9e4505e19a010ed4199e345e8a03c8664539eab1de1a6dc51781e1f417
7
- data.tar.gz: 7253369dd40a49ad1756be0f4098f901b76352289943dfd6f963f1cf0874791a611481c77e5b713ae7a8b97ccee3d6834aee87ab28c61222ed32f0e8c0e77c88
6
+ metadata.gz: c250d0c4486039dc719ee88ae93ef9cb0b66b41975626f91783091841878c50ee10f7f051f6f363f4a6fdb436b4b940fa2f3d18149b24449ada37b9f1239ab79
7
+ data.tar.gz: 4ec7e26ef2eb551826aa1ee4365aa27e2ad9318da30fb66c00f97e551b11bdab387d8b3125181c2e312ee44f9b8796fee382983e29c02de33339af18e1a514b6
@@ -15,6 +15,7 @@ module TestrailRSpec
15
15
  end
16
16
 
17
17
  setup_testrail_client
18
+ config_validator if $config_validator.nil?
18
19
  end
19
20
 
20
21
  def upload_result
@@ -46,12 +47,13 @@ module TestrailRSpec
46
47
 
47
48
  @run_id ||= @config['run_id']
48
49
  @run_id = @@run_id rescue @@run_id = nil unless @config['run_id']
49
- @run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", { "suite_id": @config['suite_id']}) if @run_id.nil?
50
+ @run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", {"suite_id": @config['suite_id']}) if @run_id.nil?
50
51
 
51
52
  case_list.map do |case_id|
53
+ check_avail(:case_id, case_id)
52
54
  response = client.send_post(
53
55
  "add_result_for_case/#{@run_id}/#{case_id}",
54
- { status_id: status_id, comment: message }
56
+ {status_id: status_id, comment: message}
55
57
  )
56
58
  end
57
59
 
@@ -70,6 +72,17 @@ module TestrailRSpec
70
72
  @client.password = @config['password']
71
73
  end
72
74
 
75
+ def config_validator
76
+ config_hash = {:project_id => @config['project_id'], :suite_id => @config['suite_id'], :run_id => @config['run_id']}
77
+ config_hash.map do |key, value|
78
+ next if value.nil?
79
+ check_avail(key, value)
80
+ end
81
+
82
+ cleaner if [@config['project_id'], @config['clean_testrun'], @config['run_id'].nil?].all?
83
+ $config_validator = true
84
+ end
85
+
73
86
  def get_status_id(status)
74
87
  case status
75
88
  when :passed
@@ -88,5 +101,27 @@ module TestrailRSpec
88
101
  raise 'unexpected scenario status passed'
89
102
  end
90
103
  end
104
+
105
+ def cleaner
106
+ test_run_list = client.send_get("get_runs/#{@config['project_id']}")
107
+ test_run_list.map do |list|
108
+ client.send_post("delete_run/#{list['id']}", {"suite_id": @config['suite_id']})
109
+ end
110
+ end
111
+
112
+ def check_avail(label, id)
113
+ case label
114
+ when :project_id
115
+ warn("\n###################### \ninvalid #project_id: #{id} \n######################") if client.send_get("get_project/#{id}").nil?
116
+ when :suite_id
117
+ warn("\n###################### \ninvalid #suite_id: #{id} \n######################") if client.send_get("get_suite/#{id}").nil?
118
+ when :run_id
119
+ warn("\n###################### \ninvalid #run_id: #{id} \n######################") if client.send_get("get_run/#{id}").nil?
120
+ when :case_id
121
+ warn("\n###################### \ninvalid #case_id: #{id} \n######################") if client.send_get("get_case/#{id}").nil?
122
+ else
123
+ p "no config available"
124
+ end
125
+ end
91
126
  end
92
127
  end
@@ -1,3 +1,3 @@
1
1
  module TestrailRspec
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrail-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prashanth Sams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-19 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler