allure-rspec 2.23.0 → 2.24.3

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
  SHA256:
3
- metadata.gz: dcf4e56c709ebc9a8f2bc520eeb4fa572d419ec1d10211b0386c98cf28c3f449
4
- data.tar.gz: 7ef318519ac4615264181315a8f15a6866c5991749c6ed1ade070523bebafbae
3
+ metadata.gz: 278a734ca879b0caa45567842d89ddd4b399d24969f159df4e3bd76dc1adf96d
4
+ data.tar.gz: 65bfa9bf84a77c5aed0437f31ec9b9169c5ff9d00770f9d27538dfa342af2d9d
5
5
  SHA512:
6
- metadata.gz: 750edeeb4fc5bbce396a0d7b20c1514a87a7256a1ae81f1e4a81d4e043203923b81297282cdf58303af0db6ec736ceff8623c46b290eb24251be0f646d4e7b9a
7
- data.tar.gz: 68cd9af035336a6d5e42b978587083e0dafa1b193d7c053dccecb681ef5166a87c178810272944f524610ed049fc1bdb0bf75c830e27438a7211b8ecb0458b36
6
+ metadata.gz: d4c2033e3054c1a609d5d594f4c5cc17749897e0aa50423676a35e984131f2f42b5ded9b7d076d489d3af0b1e8a3af174128b16b46ea362d07e77dccb3159bff
7
+ data.tar.gz: f504806aa1fbfc6365d2670105f4d2cf15d061eeace99550148ed986798b5814ea7f59ab2741c6b3dd7ce44e89463edf0812ac60b4ae757a283c3469e432bc82
data/README.md CHANGED
@@ -207,6 +207,18 @@ it "some test case 2", story: "user story" do
207
207
  end
208
208
  ```
209
209
 
210
+ ### Custom failure exception
211
+
212
+ Allure report will mark steps and tests as either `Failed` or `Broken` based on exception class that was raised. By default, `RSpec::Expectations::ExpectationNotMetError` exception will mark test as `Failed` and all other exceptions will mark test as `Broken`.
213
+
214
+ Custom failure exception class can be configured:
215
+
216
+ ```ruby
217
+ AllureRspec.configure do |config|
218
+ config.failure_exception = MyCustomFailedException
219
+ end
220
+ ```
221
+
210
222
  ### Custom actions
211
223
 
212
224
  Rspec example object has access to [Allure](https://www.rubydoc.info/github/allure-framework/allure-ruby/Allure) helper methods.
@@ -21,7 +21,6 @@ module AllureRspec
21
21
  # @return [String]
22
22
  class RspecConfig
23
23
  include Singleton
24
- extend Forwardable
25
24
 
26
25
  # @return [Symbol] default tms tag
27
26
  DEFAULT_TMS_TAG = :tms
@@ -36,26 +35,6 @@ module AllureRspec
36
35
  # @return [Symbol] default story tag
37
36
  DEFAULT_STORY_TAG = :story
38
37
 
39
- def_delegators :@allure_config,
40
- :clean_results_directory,
41
- :clean_results_directory=,
42
- :link_issue_pattern,
43
- :link_issue_pattern=,
44
- :link_tms_pattern,
45
- :link_tms_pattern=,
46
- :logging_level,
47
- :logging_level=,
48
- :logger,
49
- :logger=,
50
- :results_directory,
51
- :results_directory=,
52
- :environment,
53
- :environment=,
54
- :environment_properties,
55
- :environment_properties=,
56
- :categories,
57
- :categories=
58
-
59
38
  def initialize
60
39
  @allure_config = Allure.configuration
61
40
  end
@@ -102,5 +81,13 @@ module AllureRspec
102
81
  def ignored_tags
103
82
  @ignored_tags || []
104
83
  end
84
+
85
+ def method_missing(method, ...)
86
+ @allure_config.respond_to?(method) ? @allure_config.send(method, ...) : super
87
+ end
88
+
89
+ def respond_to_missing?(method, include_private = false)
90
+ @allure_config.respond_to?(method, include_private) || super
91
+ end
105
92
  end
106
93
  end
@@ -104,8 +104,8 @@ module AllureRspec
104
104
 
105
105
  Allure::TestResult.new(
106
106
  name: example.description,
107
- description: "Location - #{strip_relative(example.location)}",
108
- description_html: "Location - #{strip_relative(example.location)}",
107
+ description: "Location - #{strip_relative(parser.location)}",
108
+ description_html: "Location - #{strip_relative(parser.location)}",
109
109
  history_id: example.id,
110
110
  full_name: example.full_description,
111
111
  labels: parser.labels,
@@ -31,7 +31,7 @@ module AllureRspec
31
31
  # Metadata parser instance
32
32
  #
33
33
  # @param [RSpec::Core::Example] example
34
- # @param [AllureRspec::RspecConfig] config <description>
34
+ # @param [AllureRspec::RspecConfig] config
35
35
  def initialize(example, config)
36
36
  @example = example
37
37
  @config = config
@@ -67,6 +67,21 @@ module AllureRspec
67
67
  )
68
68
  end
69
69
 
70
+ # Example location
71
+ #
72
+ # @return [String]
73
+ def location
74
+ file = example
75
+ .metadata
76
+ .fetch(:shared_group_inclusion_backtrace)
77
+ .last
78
+ &.formatted_inclusion_location
79
+
80
+ return example.location unless file
81
+
82
+ file
83
+ end
84
+
70
85
  private
71
86
 
72
87
  # @return [RSpec::Core::Example]
@@ -143,12 +158,12 @@ module AllureRspec
143
158
  # @param [Symbol] type
144
159
  # @return [Array<Allure::Link>]
145
160
  def matching_links(type)
146
- link_pattern = config.public_send("link_#{type}_pattern")
161
+ link_pattern = config.public_send(:"link_#{type}_pattern")
147
162
  return [] unless link_pattern
148
163
 
149
164
  metadata
150
- .select { |key| __send__("#{type}?", key) }
151
- .map { |key, value| Allure::ResultUtils.public_send("#{type}_link", key.to_s, value, link_pattern) }
165
+ .select { |key| __send__(:"#{type}?", key) }
166
+ .map { |key, value| Allure::ResultUtils.public_send(:"#{type}_link", key.to_s, value, link_pattern) }
152
167
  end
153
168
 
154
169
  # Label value from custom metadata
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.23.0
4
+ version: 2.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2024-04-16 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.23.0
19
+ version: 2.24.3
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.23.0
26
+ version: 2.24.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.4.10
85
+ rubygems_version: 3.5.3
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Allure rspec ruby adaptor