allure-rspec 2.13.3 → 2.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/allure_rspec/formatter.rb +2 -1
- data/lib/allure_rspec/rspec_model.rb +34 -17
- data/lib/allure_rspec/tag_parser.rb +17 -8
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afcc5a2dfc396dc25bdf88815e525a64150e6929b6888b7d416ecbcb458abf8e
|
4
|
+
data.tar.gz: 4566d418f42a82c7cbdb03f08f9812afc468ff2cf9866dafeb42e37e8e0031a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21da1ae0df8fc7c5b1baa1c7fa561366f24cb77f0de0a79fe31389ce79d263b9de6ba23ec864fe66f6f32383a0d5080890794085d2f3c95632be37fce615b8ee
|
7
|
+
data.tar.gz: c46c715f9a11543e910cea93a8bc087aa02daab854ca8baa2e8d993496ce5bed06690957e43cb5e9c50a317b6db0dacd6f453c69d9ff17d6aa0ba756df11e654
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "ruby2_keywords"
|
3
4
|
require "rspec/core"
|
4
5
|
require "rspec/core/formatters/base_formatter"
|
5
6
|
|
@@ -20,7 +21,7 @@ module AllureRspec
|
|
20
21
|
|
21
22
|
RSpec::Core::Example.class_eval do
|
22
23
|
Allure.singleton_methods.each do |method|
|
23
|
-
define_method(method) { |*args, &block| Allure.__send__(method, *args, &block) }
|
24
|
+
ruby2_keywords define_method(method) { |*args, &block| Allure.__send__(method, *args, &block) }
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -48,6 +48,21 @@ module AllureRspec
|
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
|
+
# @param [RSpec::Core::Example] example
|
52
|
+
# @return [Array<Allure::Label>]
|
53
|
+
def links(example)
|
54
|
+
tms_links(example.metadata) + issue_links(example.metadata)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get allure status from result
|
58
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
59
|
+
# @return [Symbol]
|
60
|
+
def status(result)
|
61
|
+
return Allure::ResultUtils.status(result.exception) if result.status == :failed
|
62
|
+
|
63
|
+
ALLURE_STATUS[result.status]
|
64
|
+
end
|
65
|
+
|
51
66
|
# @param [RSpec::Core::Example] example
|
52
67
|
# @return [Array<Allure::Label>]
|
53
68
|
def labels(example)
|
@@ -58,8 +73,8 @@ module AllureRspec
|
|
58
73
|
labels << Allure::ResultUtils.story_label(example.description)
|
59
74
|
labels << Allure::ResultUtils.test_class_label(File.basename(example.file_path, ".rb"))
|
60
75
|
labels << severity(example.metadata)
|
61
|
-
labels.push(*suite_labels(example.example_group))
|
62
76
|
labels.push(*tag_labels(example.metadata))
|
77
|
+
labels.push(*suite_labels(example.example_group))
|
63
78
|
end
|
64
79
|
end
|
65
80
|
|
@@ -67,28 +82,30 @@ module AllureRspec
|
|
67
82
|
# @param [RSpec::Core::ExampleGroup] example_group
|
68
83
|
# @return [Array<Allure::Label>]
|
69
84
|
def suite_labels(example_group)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
85
|
+
[].tap do |labels|
|
86
|
+
parents = example_group.parent_groups.map(&:description)
|
87
|
+
labels << Allure::ResultUtils.suite_label(suite(parents))
|
88
|
+
labels << Allure::ResultUtils.parent_suite_label(parent_suite(parents))
|
89
|
+
labels << Allure::ResultUtils.sub_suite_label(sub_suites(parents))
|
76
90
|
end
|
77
91
|
end
|
78
92
|
|
79
|
-
# @param [
|
80
|
-
# @return [
|
81
|
-
def
|
82
|
-
|
93
|
+
# @param [Array<String>] parents
|
94
|
+
# @return [String]
|
95
|
+
def suite(parents)
|
96
|
+
parents.length == 1 ? parents.last : parents[-2]
|
83
97
|
end
|
84
98
|
|
85
|
-
#
|
86
|
-
# @
|
87
|
-
|
88
|
-
|
89
|
-
|
99
|
+
# @param [Array<String>] parents
|
100
|
+
# @return [String]
|
101
|
+
def parent_suite(parents)
|
102
|
+
parents.length > 1 ? parents.last : nil
|
103
|
+
end
|
90
104
|
|
91
|
-
|
105
|
+
# @param [Array<String>] parents
|
106
|
+
# @return [String]
|
107
|
+
def sub_suites(parents)
|
108
|
+
parents.length > 2 ? parents[0..-3].join(" > ") : nil
|
92
109
|
end
|
93
110
|
|
94
111
|
# Strip relative ./ form path
|
@@ -7,27 +7,23 @@ module AllureRspec
|
|
7
7
|
# @param [Hash] metadata
|
8
8
|
# @return [Array<Allure::Label>]
|
9
9
|
def tag_labels(metadata)
|
10
|
-
return [] unless
|
10
|
+
return [] unless metadata.keys.any? { |k| allure?(k) }
|
11
11
|
|
12
|
-
metadata.select { |k
|
12
|
+
metadata.select { |k| allure?(k) }.values.map { |v| Allure::ResultUtils.tag_label(v) }
|
13
13
|
end
|
14
14
|
|
15
15
|
# Get tms links
|
16
16
|
# @param [Hash] metadata
|
17
17
|
# @return [Array<Allure::Link>]
|
18
18
|
def tms_links(metadata)
|
19
|
-
|
20
|
-
|
21
|
-
metadata.select { |k, _v| tms?(k) }.values.map { |v| Allure::ResultUtils.tms_link(v) }
|
19
|
+
matching_links(metadata, :tms)
|
22
20
|
end
|
23
21
|
|
24
22
|
# Get issue links
|
25
23
|
# @param [Hash] metadata
|
26
24
|
# @return [Array<Allure::Link>]
|
27
25
|
def issue_links(metadata)
|
28
|
-
|
29
|
-
|
30
|
-
metadata.select { |k, _v| issue?(k) }.values.map { |v| Allure::ResultUtils.issue_link(v) }
|
26
|
+
matching_links(metadata, :issue)
|
31
27
|
end
|
32
28
|
|
33
29
|
# Get severity
|
@@ -50,6 +46,19 @@ module AllureRspec
|
|
50
46
|
|
51
47
|
private
|
52
48
|
|
49
|
+
# @param [Hash] metadata
|
50
|
+
# @param [Symbol] type
|
51
|
+
# @return [Array<Allure::Link>]
|
52
|
+
def matching_links(metadata, type)
|
53
|
+
unless Allure::Config.public_send("link_#{type}_pattern") && metadata.keys.any? { |k| __send__("#{type}?", k) }
|
54
|
+
return []
|
55
|
+
end
|
56
|
+
|
57
|
+
metadata
|
58
|
+
.select { |k| __send__("#{type}?", k) }.values
|
59
|
+
.map { |v| Allure::ResultUtils.public_send("#{type}_link", v) }
|
60
|
+
end
|
61
|
+
|
53
62
|
# Does key match custom allure label
|
54
63
|
# @param [Symbol] key
|
55
64
|
# @return [boolean]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allure-ruby-commons
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.13.
|
19
|
+
version: 2.13.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.13.
|
26
|
+
version: 2.13.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby2_keywords
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.2
|
41
55
|
description: Cucumber adaptor to generate rich allure test reports
|
42
56
|
email: andrejs.cunskis@gmail.com
|
43
57
|
executables: []
|
@@ -73,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '0'
|
75
89
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.1.2
|
77
91
|
signing_key:
|
78
92
|
specification_version: 4
|
79
93
|
summary: Allure rspec ruby adaptor
|