testrailtagging 0.3.7 → 0.3.8

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: d3acaba01eab6b37fc87b8447823b2be644f3863
4
- data.tar.gz: a7a692757ab0637b137943a1f97d4c8cf4541812
3
+ metadata.gz: 043493a053345e487efd56096ae7ebb8ff889c35
4
+ data.tar.gz: d05a5558437740416920897dca9c2bf1d96e4c33
5
5
  SHA512:
6
- metadata.gz: ac04be9e95ed0dcf8a027b80b132e37a349fcaaa72ca4d2f850162371578c4a3be77d3d6c6016609d3ed50b83a2956469d0ecc138a8a01387af248c490a32e56
7
- data.tar.gz: f279a180c9fa138820c34a3af5512c805f318b0ef53fd57d8a94a3924d9a39ecc6c0aa9e84b9188d993406b16a0a48ad2392c8621db33ecbce7c174f01cde6e3
6
+ metadata.gz: fda3dc29d0f7e06af87ef35128756f36fab9605897d97e15e3dff8005174150d974fa6b3ad50bc2309b3a7cbccda10269e549c1aeee59dbf8e30a1bf9a9d627e
7
+ data.tar.gz: 8adf9f12cff9f2939048879f0ddb9f1ad0e49a2f71f5dd2bad28a3ab5d6419e675ea29665ef22df5f8e0b774a94f4b1a800b9b0abe47622cd9e19d9bf16edbc4
@@ -242,16 +242,20 @@ module TestCaseModifications
242
242
  testrail_ids = get_example_testrail_ids(line)
243
243
  testrail_ids.each do |id|
244
244
  # puts " id: #{id}"
245
- tc = test_cases[id]
245
+ tc = test_cases.delete(id)
246
246
  if tc
247
247
  if file != tc.file
248
- puts "\r\nID: #{id} - #{tc.title[0,20]}"
248
+ puts "\r\nID: #{id} - #{tc.title[0,50]}#{(tc.title.length > 50) ? '...' : ''}}"
249
249
  puts " Old File: #{tc.file}"
250
250
  puts " New File: #{file}"
251
251
  tc.file = file
252
252
  changed_cases[id] = tc
253
253
  end
254
254
 
255
+ # if the current testcase is marked run once, leave it. otherwise, mark it as
256
+ # run once if the file it is found to be in is a request spec
257
+ tc.run_once ||= (file =~ /^spec\/requests\/.*_spec\.rb$/i).nil? ? false : true
258
+
255
259
  # assuming it never becomes un-automated
256
260
  unless tc.automated
257
261
  puts " ID: #{id} Marking automated"
@@ -267,12 +271,18 @@ module TestCaseModifications
267
271
  end
268
272
  end
269
273
 
274
+ # remaining testcases should be unautomated, ensure they are
275
+ check_unautomated(test_cases, changed_cases)
276
+
270
277
  puts "\nTest Cases that will get modified" if changed_cases.count > 0
271
278
  trclient = TestRailOperations.get_test_rail_client
272
279
  changed_cases.each do |id_key, tc_val|
273
280
  puts "Test Case: id: #{id_key}, #{tc_val.file}" if tc_val.file
274
281
  url = "update_case/#{id_key}"
275
- data = { "custom_spec_location" => tc_val.file, "custom_automated" => tc_val.automated }
282
+ data = { "custom_spec_location" => tc_val.file,
283
+ "custom_automated" => tc_val.automated,
284
+ "custom_run_once" => tc_val.run_once
285
+ }
276
286
  unless dryrun
277
287
  trclient.send_post_retry(url, data)
278
288
  end
@@ -431,4 +441,31 @@ module TestCaseModifications
431
441
  end
432
442
  end
433
443
  end
444
+
445
+ private
446
+
447
+ def self.check_unautomated(testcases, changed_cases)
448
+ testcases.each do |id, testcase|
449
+ if testcase.automated || !testcase.file.empty?
450
+ testcase.automated = false
451
+
452
+ unless testcase.file.empty?
453
+ regex = /testrail_id:(.*)(\[|\s)#{testcase.id}(\]|\s)/
454
+
455
+ begin
456
+ if File.foreach(testcase.file).grep(regex).empty?
457
+ testcase.file = ""
458
+ else
459
+ testcase.automated = true # should only ever hit this if #update_automated_status doesn't work correctly
460
+ end
461
+ rescue Errno::ENOENT
462
+ puts "No such file or directory: #{testcase.file}"
463
+ testcase.file = ""
464
+ end
465
+ end
466
+
467
+ changed_cases[id] = testcase
468
+ end
469
+ end
470
+ end
434
471
  end
data/lib/files/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Testrailtagging
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrailtagging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Johnson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.2.2
128
+ rubygems_version: 2.4.5.1
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Utilities for working with testrail.