allure-ruby-commons 2.13.1 → 2.13.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34bd95847a64b20e7599bf9e31d1dea65c03b1d161c0c93065c6c17ec93b21e4
|
4
|
+
data.tar.gz: 2720242585f11632fc7210ab296f680a7c9928f844e68af016c9f28ffe83c5a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4d9fb6e73b70e3c93053b4167e12f5f5a1ef2f18288b5b934e92f1e35ec1a29afad6bff1bb86a72f7571640a1e2b899b324e33a8fd179e4762c47156f711d74
|
7
|
+
data.tar.gz: f018a79ecba6691ebefa373b82d6b79ac68da29f1da7e8e0176c591c03551b5d714848700e0b3e1d35789ece55940f8c7160a7f2c86e69f1a00c3e8ae465f6c8
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Allure Ruby Adaptor API
|
2
|
+
[](https://www.rubydoc.info/gems/allure-ruby-commons)
|
2
3
|
|
3
4
|
This is a helper library containing the basics for any ruby-based Allure adaptor.
|
4
5
|
Using it you can easily implement the adaptor for your favorite ruby testing library or
|
data/lib/allure-ruby-commons.rb
CHANGED
@@ -138,6 +138,13 @@ module Allure
|
|
138
138
|
lifecycle.add_attachment(name: name, source: source, type: type, test_case: test_case)
|
139
139
|
end
|
140
140
|
|
141
|
+
# Write allure report environment info
|
142
|
+
# @param [Hash<Symbol, String>] environment
|
143
|
+
# @return [void]
|
144
|
+
def add_environment(environment)
|
145
|
+
lifecycle.write_environment(environment)
|
146
|
+
end
|
147
|
+
|
141
148
|
# Add step with provided name and optional status to current test step, fixture or test case
|
142
149
|
# @param [String] name
|
143
150
|
# @param [Symbol] status <Allure::Status>, <Allure::Status::PASSED> by default
|
@@ -1,15 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "fileutils"
|
4
|
+
require "forwardable"
|
4
5
|
|
5
6
|
module Allure
|
6
7
|
# Main class for creating and writing allure results
|
7
8
|
class AllureLifecycle
|
9
|
+
extend Forwardable
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
@test_context = []
|
10
13
|
@step_context = []
|
11
14
|
end
|
12
15
|
|
16
|
+
def_delegators :file_writer, :write_attachment, :write_environment
|
17
|
+
|
13
18
|
# Start test result container
|
14
19
|
# @param [Allure::TestResultContainer] test_result_container
|
15
20
|
# @return [Allure::TestResultContainer]
|
@@ -208,14 +213,6 @@ module Allure
|
|
208
213
|
Attachment.new(name: name, source: file_name, type: type)
|
209
214
|
end
|
210
215
|
|
211
|
-
# Write attachment file
|
212
|
-
# @param [File, String] source
|
213
|
-
# @param [Allure::Attachment] attachment
|
214
|
-
# @return [void]
|
215
|
-
def write_attachment(source, attachment)
|
216
|
-
file_writer.write_attachment(source, attachment)
|
217
|
-
end
|
218
|
-
|
219
216
|
# Add step to current fixture|step|test case
|
220
217
|
# @param [Allure::StepResult] step_result
|
221
218
|
# @return [Allure::StepResult]
|
@@ -32,6 +32,15 @@ module Allure
|
|
32
32
|
source.is_a?(File) ? copy(source.path, attachment.source) : write(attachment.source, source)
|
33
33
|
end
|
34
34
|
|
35
|
+
# Write allure report environment info
|
36
|
+
# @param [Hash<Symbol, String>] environment
|
37
|
+
# @return [void]
|
38
|
+
def write_environment(environment)
|
39
|
+
environment.reduce("") { |e, (k, v)| e + "#{k}=#{v}\n" }.tap do |env|
|
40
|
+
write("environment.properties", env)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
35
44
|
private
|
36
45
|
|
37
46
|
def output_dir
|
@@ -135,7 +135,7 @@ module Allure
|
|
135
135
|
# @param [Exception] exception
|
136
136
|
# @return [Symbol]
|
137
137
|
def status(exception)
|
138
|
-
|
138
|
+
exception.is_a?(RSpec::Expectations::ExpectationNotMetError) ? Status::FAILED : Status::BROKEN
|
139
139
|
end
|
140
140
|
|
141
141
|
# Get exception status detail
|
@@ -154,11 +154,6 @@ module Allure
|
|
154
154
|
def issue_url(value)
|
155
155
|
Allure.configuration.link_issue_pattern.sub("{}", value)
|
156
156
|
end
|
157
|
-
|
158
|
-
def expectation_error?(exception)
|
159
|
-
exception.instance_of?(RSpec::Expectations::ExpectationNotMetError) ||
|
160
|
-
exception.instance_of?(RSpec::Expectations::MultipleExpectationsNotMetError)
|
161
|
-
end
|
162
157
|
end
|
163
158
|
end
|
164
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-ruby-commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuid
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: require_all
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2'
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '4'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2'
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '4'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: json
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|