allure-rspec 2.13.5.rc.1 → 2.13.5.rc.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: 4d211dfccb64872fd47535b5707249c8d0f1f0833ef92e40bee8056ecec98b2b
4
- data.tar.gz: 5c2cfc994e6eb08eb2c854fa4f7b09789e2523f643a391c76aecd81a0e48ffb8
3
+ metadata.gz: b6f877f7e8b441cb54130d306d3412f312acb8797897183858835c9f022435b8
4
+ data.tar.gz: 3c2addeb4d4b3e019f33993bd5b323dde85193c703d72f5e9f61c9045f85a7db
5
5
  SHA512:
6
- metadata.gz: 9d5b65f235bc3d45081422acf20d06de4504e2da1a2f90b81c82411e5f141cf023ad7d4b9541ef9c02ab2679888c21f09a1cd3a46661328d74260da7515a9738
7
- data.tar.gz: fe054a2c43246b668f1d2f508e896536bb09425603d2539c619fb54334e38e556a0b3dfe8b06ede0d0554d7848c56c3c2aa7d3e747f5e645d749621784201e17
6
+ metadata.gz: c115ec1a95e9f14faed2298b54a29b3dbad62562864c14f635bcec78388fab4be67ef09489dcfa1c5b624fd08c00440f3f408dead25ecf387808630f9ea7e40d
7
+ data.tar.gz: be99a4b2fa09a6cfde214028c1d79bdd7b8877eb7dc4f178b80a4475d56d08a8016d44cf28f4841e0f8fb125e6e0b088e35ddd5a619e71aca4b794572cf9d063
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # allure-rspec
2
+
2
3
  [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/gems/allure-rspec)
3
4
 
4
5
  Allure adapter for [rspec](https://rspec.info/) testing framework
@@ -8,32 +9,45 @@ Allure adapter for [rspec](https://rspec.info/) testing framework
8
9
  Add it to gemfile:
9
10
 
10
11
  ```ruby
11
- gem 'allure-rspec'
12
+ gem "allure-rspec"
12
13
  ```
13
14
 
14
15
  Require in `spec_helper` or any other setup file:
15
16
 
16
17
  ```ruby
17
- require `allure-rspec`
18
+ require "allure-rspec"
18
19
  ```
19
20
 
20
21
  ## Configuration
21
22
 
22
- There are no rspec adapter specific configuration options. Main allure configuration is described [here](https://github.com/allure-framework/allure-ruby/blob/master/allure-ruby-commons/README.md#configuration)
23
+ Following configuration options are supported:
24
+
25
+ ```ruby
26
+ AllureRspec.configure do |config|
27
+ config.results_directory = "/whatever/you/like"
28
+ config.clean_results_directory = true
29
+ config.logging_level = Logger::INFO
30
+ # these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
31
+ config.link_tms_pattern = "http://www.jira.com/browse/{}"
32
+ config.link_issue_pattern = "http://www.jira.com/browse/{}"
33
+ end
34
+ ```
23
35
 
24
36
  ## Usage
25
37
 
26
- Via commandline, simply add:
38
+ Via commandline arguments, simply add:
27
39
 
28
40
  ```bash
29
41
  --format AllureRspecFormatter
30
42
  ```
31
43
 
32
- RSpec configuration:
44
+ or
45
+
46
+ Via RSpec configuration:
33
47
 
34
48
  ```ruby
35
- RSpec.configure do |c|
36
- c.formatter = AllureRspecFormatter
49
+ RSpec.configure do |config|
50
+ config.formatter = AllureRspecFormatter
37
51
  end
38
52
  ```
39
53
 
@@ -42,8 +56,8 @@ end
42
56
  Configure tms link pattern:
43
57
 
44
58
  ```ruby
45
- Allure.configure do |c|
46
- c.link_tms_pattern = "http://www.jira.com/browse/{}"
59
+ AllureRspec.configure do |config|
60
+ config.link_tms_pattern = "http://www.jira.com/browse/{}"
47
61
  end
48
62
  ```
49
63
 
@@ -68,8 +82,8 @@ end
68
82
  Configure issue link pattern:
69
83
 
70
84
  ```ruby
71
- Allure.configure do |c|
72
- c.link_issue_pattern = "http://www.jira.com/browse/{}"
85
+ AllureRspec.configure do |config|
86
+ config.link_issue_pattern = "http://www.jira.com/browse/{}"
73
87
  end
74
88
  ```
75
89
 
data/lib/allure-rspec.rb CHANGED
@@ -2,8 +2,27 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "allure-ruby-commons"
5
+ require "allure_rspec/config"
5
6
  require "allure_rspec/formatter"
6
7
 
8
+ module AllureRspec
9
+ class << self
10
+ # Get allure cucumber configuration
11
+ # @return [RspecConfig]
12
+ def configuration
13
+ RspecConfig.instance
14
+ end
15
+
16
+ # Set allure configuration
17
+ # @yieldparam [RspecConfig]
18
+ # @yieldreturn [void]
19
+ # @return [void]
20
+ def configure
21
+ yield(configuration)
22
+ end
23
+ end
24
+ end
25
+
7
26
  # Rspec formatter class shorthand
8
27
  AllureRspecFormatter = AllureRspec::RSpecFormatter
9
28
  # rubocop:enable Naming/FileName
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+ require "singleton"
5
+
6
+ module AllureRspec
7
+ # Shorthand configuration class
8
+ class RspecConfig < Allure::Config
9
+ include Singleton
10
+ extend Forwardable
11
+
12
+ def_delegators :@allure_config,
13
+ :clean_results_directory,
14
+ :clean_results_directory=,
15
+ :link_issue_pattern,
16
+ :link_issue_pattern=,
17
+ :link_tms_pattern,
18
+ :link_tms_pattern=,
19
+ :logging_level,
20
+ :logging_level=,
21
+ :results_directory,
22
+ :results_directory=
23
+
24
+ def initialize
25
+ @allure_config = Allure.configuration
26
+ end
27
+ end
28
+ end
@@ -50,7 +50,8 @@ module AllureRspec
50
50
  # @param [Symbol] type
51
51
  # @return [Array<Allure::Link>]
52
52
  def matching_links(metadata, type)
53
- unless Allure::Config.public_send("link_#{type}_pattern") && metadata.keys.any? { |k| __send__("#{type}?", k) }
53
+ unless AllureRspec.configuration.public_send("link_#{type}_pattern") &&
54
+ metadata.keys.any? { |k| __send__("#{type}?", k) }
54
55
  return []
55
56
  end
56
57
 
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.5.rc.1
4
+ version: 2.13.5.rc.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: 2020-03-28 00:00:00.000000000 Z
11
+ date: 2020-03-29 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.5.rc.1
19
+ version: 2.13.5.rc.2
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.5.rc.1
26
+ version: 2.13.5.rc.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -60,6 +60,7 @@ extra_rdoc_files: []
60
60
  files:
61
61
  - README.md
62
62
  - lib/allure-rspec.rb
63
+ - lib/allure_rspec/config.rb
63
64
  - lib/allure_rspec/formatter.rb
64
65
  - lib/allure_rspec/rspec_model.rb
65
66
  - lib/allure_rspec/tag_parser.rb