assertthat-bdd 1.1.0 → 1.5.0

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: 90d148c2e22d1110f6c61b513c36fc64428710ab22d83dd93c1ae8c89419163e
4
- data.tar.gz: c83dd62a77345624400751fc1ad00396c84205e76d5d2223715c4f62db2d7d02
3
+ metadata.gz: 4e15b2d3b006bf3f512e0500d0010f24a60334b73de44778f2a56d1d77cf1a58
4
+ data.tar.gz: 5c7a16d25c2944e5c9805fc9034aab2665d79a028e2cab2cd9dd45e5f9d42b2c
5
5
  SHA512:
6
- metadata.gz: 865042a3aa9b8c0ea0ae182711d61c60724def7c0750b69e5881dc69c0941ee1d1f557dcaefadf6bb1d8785c51b7e5577fc06eaeb777d210d5bc457af4943aca
7
- data.tar.gz: 13e6ba610abcdddaea4b0b7449e2f1b4d038d5526a879a7296ad79a7bf96070efe4b3df32ea6c326fa77889bf1b399e57fe976badac59223e831a186d9dd9d8e
6
+ metadata.gz: db72766225400afb9e6fdcef3fb477b766d7cfe612be5e9252d24e95e84eff9ab5ed9237c92e4f0e67c0ba476f0f845a5eb4edb25d711c5d23c06a7d68d9eaf4
7
+ data.tar.gz: 1d62e0b8393dcead620285101149a3f4aa3b21f09f07f910a10df0d01840c72dccda38b5817f2b078b700700111980c4ed0be3b1d84b85439a51be43397d262c
@@ -1,31 +1,33 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.0.2'
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('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
12
- opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
13
- opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
14
- opt.on('-j','--jql JQL_FILTER', 'Jql issues filter') { |o| options[:jql] = o }
15
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
16
- opt.on_tail('-h', '--help', 'Show help') do
17
- puts opt
18
- exit
19
- end
20
- opt.on_tail('-v','--version', 'Show version') do
21
- puts VERSION
22
- exit
23
- end
24
- end.parse!
25
-
26
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
27
-
28
- AssertThatBDD::Features.download(options)
29
-
30
-
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
+
31
33
 
@@ -1,30 +1,31 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.0.2'
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('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
12
- opt.on('-n','--runName RUN_NAME', 'The name of the run - default \'Test run dd MMM yyyy HH:mm:ss\'') { |o| options[:runName] = o }
13
- opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
14
- opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
15
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
16
- opt.on_tail('-h', '--help', 'Show help') do
17
- puts opt
18
- exit
19
- end
20
- opt.on_tail('-v','--version', 'Show version') do
21
- puts VERSION
22
- exit
23
- end
24
- end.parse!
25
-
26
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
27
-
28
- AssertThatBDD::Report.upload(options)
29
-
30
-
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,92 +1,99 @@
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: '')
9
- RestClient.proxy = proxy unless proxy.nil?
10
- url = 'https://bdd.assertthat.app/rest/api/1/project/'+ projectId +'/features'
11
- resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
12
- begin
13
- contents = resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql})
14
- rescue => e
15
-
16
- if e.respond_to?('response') then
17
- if e.response.respond_to?('code') then
18
- case e.response.code
19
- when 401
20
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
21
- when 400
22
- puts '*** ERROR: ' + e.response
23
- when 500
24
- puts '*** ERROR: Jira server error (500)'
25
- end
26
- end
27
- else
28
- puts '*** ERROR: Failed download features: ' + e.message
29
- end
30
- return
31
- end
32
- Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
33
- File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(contents) }
34
- features_count = 0
35
- Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
36
- zip_file.each do |entry|
37
- features_count = features_count + 1
38
- File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
39
- entry.extract("#{outputFolder}#{entry.name}")
40
- end
41
- end
42
- puts "*** INFO: #{features_count} features downloaded"
43
- File.delete("#{outputFolder}/features.zip")
44
- end
45
- end
46
-
47
- class Report
48
- 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' )
49
- url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
50
- files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
51
- puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
52
- puts "*** INFO: #{files}"
53
- runId = -1
54
- files.each do |f|
55
- request = RestClient::Request.new(
56
- :method => :post,
57
- :url => url,
58
- :user => accessKey,
59
- :password => secretKey,
60
- :payload => {
61
- :multipart => true,
62
- :file => File.new(f, 'rb')
63
- },
64
- :headers => { :params =>{:runName => runName, :runId=> runId}}
65
- )
66
- begin
67
- response = request.execute
68
- rescue => e
69
- if e.respond_to?('response') then
70
- if e.response.respond_to?('code') then
71
- case e.response.code
72
- when 401
73
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
74
- when 500
75
- puts '*** ERROR: Jira server error (500)'
76
- end
77
- end
78
- else
79
- puts "*** ERROR: Failed to submit json #{f}: " + e.message
80
- end
81
- return
82
- end
83
- resposne_json = JSON.parse(response)
84
- if resposne_json['result'] == 'success'
85
- runId = resposne_json['runId']
86
- else
87
- puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
88
- end
89
- end
90
- end
91
- end
92
- 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://heavy-bat-23.loca.lt/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
+ begin
14
+ resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql, tags: tags}) do |response, request, result|
15
+ Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
16
+ File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(response) }
17
+ features_count = 0
18
+ Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
19
+ zip_file.each do |entry|
20
+ features_count = features_count + 1
21
+ File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
22
+ entry.extract("#{outputFolder}#{entry.name}")
23
+ end
24
+ if response.headers.member?('features_count'.to_sym) and response.headers.member?('scenarios_count'.to_sym) then
25
+ puts "*** INFO: #{response.headers['features_count'.to_sym]} features downloaded with #{response.headers['scenarios_count'.to_sym]} scenarios"
26
+ else
27
+ puts "*** INFO: #{features_count} features downloaded"
28
+ end
29
+ File.delete("#{outputFolder}/features.zip")
30
+ rescue => e
31
+
32
+ if e.respond_to?('response') then
33
+ if e.response.respond_to?('code') then
34
+ case e.response.code
35
+ when 401
36
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
37
+ when 400
38
+ puts '*** ERROR: ' + e.response
39
+ when 500
40
+ puts '*** ERROR: Jira server error (500)'
41
+ end
42
+ end
43
+ else
44
+ puts '*** ERROR: Failed download features: ' + e.message
45
+ end
46
+ return
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ class Report
54
+ 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 )
55
+ url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
56
+ url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
57
+ files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
58
+ puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
59
+ puts "*** INFO: #{files}"
60
+ runId = -1
61
+ files.each do |f|
62
+ request = RestClient::Request.new(
63
+ :method => :post,
64
+ :url => url,
65
+ :user => accessKey,
66
+ :password => secretKey,
67
+ :payload => {
68
+ :multipart => true,
69
+ :file => File.new(f, 'rb')
70
+ },
71
+ :headers => { :params =>{:runName => runName, :runId=> runId}}
72
+ )
73
+ begin
74
+ response = request.execute
75
+ rescue => e
76
+ if e.respond_to?('response') then
77
+ if e.response.respond_to?('code') then
78
+ case e.response.code
79
+ when 401
80
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
81
+ when 500
82
+ puts '*** ERROR: Jira server error (500)'
83
+ end
84
+ end
85
+ else
86
+ puts "*** ERROR: Failed to submit json #{f}: " + e.message
87
+ end
88
+ return
89
+ end
90
+ resposne_json = JSON.parse(response)
91
+ if resposne_json['result'] == 'success'
92
+ runId = resposne_json['runId']
93
+ else
94
+ puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assertthat-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glib Briia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-09 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -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: []