assertthat-bdd 1.3.0 → 1.6.1

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: 89b7bffbb130b5733cc9b2fd356a9f864a80d708457574bd6f211bb31e1188bf
4
- data.tar.gz: bf6529f52a3ffb2c51ebbd1d268288f5a3f89cd2aeda3caf79456591e3edbc51
3
+ metadata.gz: b5c4651bc71ff0ac382616142383c8fbaaead663300bf1bff27c978dfadd8b08
4
+ data.tar.gz: 9df3b59f2726fa196806bc241f15b8875aab16efb5eecb6575ee3a8aaac191b2
5
5
  SHA512:
6
- metadata.gz: 7af3a0ef45966f55d4c38fe10386492782a42109c4e85b649bbde9df00cda59241d64489d62134cc4e41d2f610bc36dee7ae458a25972b57c4d323b0c8e9ecea
7
- data.tar.gz: c6199e9292e77abc2265ba1a36b6e7af1bb9fda66bae43de6db309aa464b5e091c2b197e40dd9c35bcb1f1fd2cef3e1bbafe510d6aea0b3799ebd41caeba4f63
6
+ metadata.gz: d008022710ba84b7caf9d9b6a9e119d61012031341d61e8ecc298a38dcb40e3fda81be87325d1c01ae910963852f60b7019d6cd178e7b0d01791d1e4961785af
7
+ data.tar.gz: 9406e8bae99ea54114ca31e06aafb1382cdeff7a66776830f15d171a7942c49c5b3281cafac8243e5b5155177253ed559c6443e53899c710eca17870f254ed79
@@ -1,32 +1,33 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.2.0'
6
-
7
- options = {}
8
- OptionParser.new do |opt|
9
- opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
- opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
- opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
- opt.on('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
- opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
14
- opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
15
- opt.on('-j','--jql JQL_FILTER', 'Jql issues filter') { |o| options[:jql] = o }
16
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
17
- opt.on_tail('-h', '--help', 'Show help') do
18
- puts opt
19
- exit
20
- end
21
- opt.on_tail('-v','--version', 'Show version') do
22
- puts VERSION
23
- exit
24
- end
25
- end.parse!
26
-
27
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
28
-
29
- AssertThatBDD::Features.download(options)
30
-
31
-
1
+ #!/usr/bin/env ruby
2
+ require 'assertthat-bdd'
3
+ require 'optparse'
4
+
5
+ VERSION = '1.2.0'
6
+
7
+ options = {}
8
+ OptionParser.new do |opt|
9
+ opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
+ opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
+ opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
+ opt.on('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
+ opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
14
+ opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
15
+ opt.on('-t','--tags <tag-expression>', 'Cucucmber tag expression for scenarios filtering') { |o| options[:tags] = o }
16
+ opt.on('-j','--jql JQL_FILTER', 'Jql issues filter') { |o| options[:jql] = o }
17
+ opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
18
+ opt.on_tail('-h', '--help', 'Show help') do
19
+ puts opt
20
+ exit
21
+ end
22
+ opt.on_tail('-v','--version', 'Show version') do
23
+ puts VERSION
24
+ exit
25
+ end
26
+ end.parse!
27
+
28
+ raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
29
+
30
+ AssertThatBDD::Features.download(options)
31
+
32
+
32
33
 
@@ -1,31 +1,31 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.2.0'
6
-
7
- options = {}
8
- OptionParser.new do |opt|
9
- opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
- opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
- opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
- opt.on('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
- opt.on('-n','--runName RUN_NAME', 'The name of the run - default \'Test run dd MMM yyyy HH:mm:ss\'') { |o| options[:runName] = o }
14
- opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
15
- opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
16
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
17
- opt.on_tail('-h', '--help', 'Show help') do
18
- puts opt
19
- exit
20
- end
21
- opt.on_tail('-v','--version', 'Show version') do
22
- puts VERSION
23
- exit
24
- end
25
- end.parse!
26
-
27
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
28
-
29
- AssertThatBDD::Report.upload(options)
30
-
31
-
1
+ #!/usr/bin/env ruby
2
+ require 'assertthat-bdd'
3
+ require 'optparse'
4
+
5
+ VERSION = '1.2.0'
6
+
7
+ options = {}
8
+ OptionParser.new do |opt|
9
+ opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
+ opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
+ opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
+ opt.on('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
+ opt.on('-n','--runName RUN_NAME', 'The name of the run - default \'Test run dd MMM yyyy HH:mm:ss\'') { |o| options[:runName] = o }
14
+ opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
15
+ opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
16
+ opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
17
+ opt.on_tail('-h', '--help', 'Show help') do
18
+ puts opt
19
+ exit
20
+ end
21
+ opt.on_tail('-v','--version', 'Show version') do
22
+ puts VERSION
23
+ exit
24
+ end
25
+ end.parse!
26
+
27
+ raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
28
+
29
+ AssertThatBDD::Report.upload(options)
30
+
31
+
@@ -1,94 +1,91 @@
1
- require 'rest-client'
2
- require 'zip'
3
- require 'find'
4
- require 'json'
5
-
6
- module AssertThatBDD
7
- class Features
8
- def self.download(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, outputFolder: './features/', proxy: nil, mode: 'automated', jql: '', jiraServerUrl: nil)
9
- RestClient.proxy = proxy unless proxy.nil?
10
- url = 'https://bdd.assertthat.app/rest/api/1/project/'+ projectId +'/features'
11
- url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/features" unless jiraServerUrl.nil?
12
- resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
13
- begin
14
- contents = resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql})
15
- rescue => e
16
-
17
- if e.respond_to?('response') then
18
- if e.response.respond_to?('code') then
19
- case e.response.code
20
- when 401
21
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
22
- when 400
23
- puts '*** ERROR: ' + e.response
24
- when 500
25
- puts '*** ERROR: Jira server error (500)'
26
- end
27
- end
28
- else
29
- puts '*** ERROR: Failed download features: ' + e.message
30
- end
31
- return
32
- end
33
- Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
34
- File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(contents) }
35
- features_count = 0
36
- Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
37
- zip_file.each do |entry|
38
- features_count = features_count + 1
39
- File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
40
- entry.extract("#{outputFolder}#{entry.name}")
41
- end
42
- end
43
- puts "*** INFO: #{features_count} features downloaded"
44
- File.delete("#{outputFolder}/features.zip")
45
- end
46
- end
47
-
48
- class Report
49
- def self.upload(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, runName: 'Test run '+Time.now.strftime("%d %b %Y %H:%M:%S"), jsonReportFolder: './reports', jsonReportIncludePattern: '.*.json', jiraServerUrl: nil )
50
- url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
51
- url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
52
- files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
53
- puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
54
- puts "*** INFO: #{files}"
55
- runId = -1
56
- files.each do |f|
57
- request = RestClient::Request.new(
58
- :method => :post,
59
- :url => url,
60
- :user => accessKey,
61
- :password => secretKey,
62
- :payload => {
63
- :multipart => true,
64
- :file => File.new(f, 'rb')
65
- },
66
- :headers => { :params =>{:runName => runName, :runId=> runId}}
67
- )
68
- begin
69
- response = request.execute
70
- rescue => e
71
- if e.respond_to?('response') then
72
- if e.response.respond_to?('code') then
73
- case e.response.code
74
- when 401
75
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
76
- when 500
77
- puts '*** ERROR: Jira server error (500)'
78
- end
79
- end
80
- else
81
- puts "*** ERROR: Failed to submit json #{f}: " + e.message
82
- end
83
- return
84
- end
85
- resposne_json = JSON.parse(response)
86
- if resposne_json['result'] == 'success'
87
- runId = resposne_json['runId']
88
- else
89
- puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
90
- end
91
- end
92
- end
93
- end
94
- end
1
+ require 'rest-client'
2
+ require 'zip'
3
+ require 'find'
4
+ require 'json'
5
+
6
+ module AssertThatBDD
7
+ class Features
8
+ def self.download(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, outputFolder: './features/', proxy: nil, mode: 'automated', jql: '', tags: '', jiraServerUrl: nil)
9
+ RestClient.proxy = proxy unless proxy.nil?
10
+ url = ['https://bdd.assertthat.app/rest/api/1/project/', projectId, '/features'].map(&:to_s).join('')
11
+ url = [jiraServerUrl,"/rest/assertthat/latest/project/",projectId,"/client/features"].map(&:to_s).join('') unless jiraServerUrl.nil?
12
+ resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
13
+ resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql, tags: tags}) do |response, request, result|
14
+ case response.code
15
+ when 401
16
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
17
+ return
18
+ when 400
19
+ puts '*** ERROR: ' + e.response
20
+ return
21
+ when 500
22
+ puts '*** ERROR: Jira server error (500)'
23
+ return
24
+ end
25
+ Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
26
+ File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(response) }
27
+ features_count = 0
28
+ Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
29
+ zip_file.each do |entry|
30
+ features_count = features_count + 1
31
+ File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
32
+ entry.extract("#{outputFolder}#{entry.name}")
33
+ end
34
+ if response.headers.member?('features_count'.to_sym) and response.headers.member?('scenarios_count'.to_sym) then
35
+ puts "*** INFO: #{response.headers['features_count'.to_sym]} features downloaded with #{response.headers['scenarios_count'.to_sym]} scenarios"
36
+ else
37
+ puts "*** INFO: #{features_count} features downloaded"
38
+ end
39
+ File.delete("#{outputFolder}/features.zip")
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ class Report
46
+ def self.upload(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, runName: 'Test run '+Time.now.strftime("%d %b %Y %H:%M:%S"), jsonReportFolder: './reports', jsonReportIncludePattern: '.*.json', jiraServerUrl: nil )
47
+ url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
48
+ url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
49
+ files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
50
+ puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
51
+ puts "*** INFO: #{files}"
52
+ runId = -1
53
+ files.each do |f|
54
+ request = RestClient::Request.new(
55
+ :method => :post,
56
+ :url => url,
57
+ :user => accessKey,
58
+ :password => secretKey,
59
+ :payload => {
60
+ :multipart => true,
61
+ :file => File.new(f, 'rb')
62
+ },
63
+ :headers => { :params =>{:runName => runName, :runId=> runId}}
64
+ )
65
+ begin
66
+ response = request.execute
67
+ rescue => e
68
+ if e.respond_to?('response') then
69
+ if e.response.respond_to?('code') then
70
+ case e.response.code
71
+ when 401
72
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
73
+ when 500
74
+ puts '*** ERROR: Jira server error (500)'
75
+ end
76
+ end
77
+ else
78
+ puts "*** ERROR: Failed to submit json #{f}: " + e.message
79
+ end
80
+ return
81
+ end
82
+ resposne_json = JSON.parse(response)
83
+ if resposne_json['result'] == 'success'
84
+ runId = resposne_json['runId']
85
+ else
86
+ puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assertthat-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glib Briia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-05-08 00:00:00.000000000 Z
@@ -50,7 +50,7 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.0.0
53
- description:
53
+ description:
54
54
  email: glib@assertthat.com
55
55
  executables:
56
56
  - assertthat-bdd-features
@@ -65,7 +65,7 @@ homepage: https://rubygems.org/gems/assertthat-bdd
65
65
  licenses:
66
66
  - MIT
67
67
  metadata: {}
68
- post_install_message:
68
+ post_install_message:
69
69
  rdoc_options: []
70
70
  require_paths:
71
71
  - lib
@@ -80,9 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 2.7.7
85
- signing_key:
83
+ rubygems_version: 3.2.22
84
+ signing_key:
86
85
  specification_version: 4
87
86
  summary: AssertThat bdd integration for Ruby
88
87
  test_files: []