allure-rspec 2.13.5.rc.1 → 2.13.6.2

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: 4d211dfccb64872fd47535b5707249c8d0f1f0833ef92e40bee8056ecec98b2b
4
- data.tar.gz: 5c2cfc994e6eb08eb2c854fa4f7b09789e2523f643a391c76aecd81a0e48ffb8
3
+ metadata.gz: 0eb8960927509e084e54343c9c8361a7b710d03889e7efae1705330cc849a2f5
4
+ data.tar.gz: c89e65654ca84322226d6884cb3e57c1ef47eb97cceb656165e3b1c26d55cf5f
5
5
  SHA512:
6
- metadata.gz: 9d5b65f235bc3d45081422acf20d06de4504e2da1a2f90b81c82411e5f141cf023ad7d4b9541ef9c02ab2679888c21f09a1cd3a46661328d74260da7515a9738
7
- data.tar.gz: fe054a2c43246b668f1d2f508e896536bb09425603d2539c619fb54334e38e556a0b3dfe8b06ede0d0554d7848c56c3c2aa7d3e747f5e645d749621784201e17
6
+ metadata.gz: 14ece6c5fadcb26819bd455713bf1d66b49f96fbd1bc1f2dd583490dd18c0912410143f1d87e93e64ba244cc81c593429283099747f17a4a4541b2c3f308089f
7
+ data.tar.gz: 5a8f7803a47043a691ae83d7c6e2f34b073ee31d14cf3d76b7848caebe344894be881f5c65660c62d09f0ddbd703b037e202acdfd366989f0a8780e8a4ecea03
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
 
@@ -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,30 @@
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
+ super()
26
+
27
+ @allure_config = Allure.configuration
28
+ end
29
+ end
30
+ end
@@ -38,9 +38,10 @@ module AllureRspec
38
38
  # @param [RSpec::Core::Notifications::GroupNotification] example_group_notification
39
39
  # @return [void]
40
40
  def example_group_started(example_group_notification)
41
- lifecycle.start_test_container(
42
- Allure::TestResultContainer.new(name: example_group_notification.group.description),
43
- )
41
+ description = example_group_notification.group.description.yield_self do |desc|
42
+ desc.empty? ? "Anonymous" : desc
43
+ end
44
+ lifecycle.start_test_container(Allure::TestResultContainer.new(name: description))
44
45
  end
45
46
 
46
47
  # Starts example
@@ -67,28 +67,30 @@ module AllureRspec
67
67
  # @param [RSpec::Core::Example] example
68
68
  # @return [Array<Allure::Label>]
69
69
  def labels(example)
70
- [].tap do |labels|
71
- labels << Allure::ResultUtils.framework_label("rspec")
72
- labels << Allure::ResultUtils.feature_label(example.example_group.description)
73
- labels << Allure::ResultUtils.package_label(Pathname.new(strip_relative(example.file_path)).parent.to_s)
74
- labels << Allure::ResultUtils.story_label(example.description)
75
- labels << Allure::ResultUtils.test_class_label(File.basename(example.file_path, ".rb"))
76
- labels << severity(example.metadata)
77
- labels.push(*tag_labels(example.metadata))
78
- labels.push(*suite_labels(example.example_group))
79
- end
70
+ labels = []
71
+ labels << Allure::ResultUtils.framework_label("rspec")
72
+ labels << Allure::ResultUtils.feature_label(example.example_group.description)
73
+ labels << Allure::ResultUtils.package_label(Pathname.new(strip_relative(example.file_path)).parent.to_s)
74
+ labels << Allure::ResultUtils.story_label(example.description)
75
+ labels << Allure::ResultUtils.test_class_label(File.basename(example.file_path, ".rb"))
76
+ labels << severity(example.metadata)
77
+ labels.push(*tag_labels(example.metadata))
78
+ labels.push(*suite_labels(example.example_group))
79
+
80
+ labels
80
81
  end
81
82
 
82
83
  # Add suite labels
83
84
  # @param [RSpec::Core::ExampleGroup] example_group
84
85
  # @return [Array<Allure::Label>]
85
86
  def suite_labels(example_group)
86
- [].tap do |labels|
87
- parents = example_group.parent_groups.map(&:description)
88
- labels << Allure::ResultUtils.suite_label(suite(parents))
89
- labels << Allure::ResultUtils.parent_suite_label(parent_suite(parents))
90
- labels << Allure::ResultUtils.sub_suite_label(sub_suites(parents))
91
- end
87
+ parents = example_group.parent_groups.map { |group| group.description.empty? ? "Anonymous" : group.description }
88
+ labels = []
89
+ labels << Allure::ResultUtils.suite_label(suite(parents))
90
+ labels << Allure::ResultUtils.parent_suite_label(parent_suite(parents)) if parent_suite(parents)
91
+ labels << Allure::ResultUtils.sub_suite_label(sub_suites(parents)) if sub_suites(parents)
92
+
93
+ labels
92
94
  end
93
95
 
94
96
  # @param [Array<String>] parents
@@ -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.6.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-08-13 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.6.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.6.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
@@ -83,9 +84,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
84
  version: 2.5.0
84
85
  required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - ">"
87
+ - - ">="
87
88
  - !ruby/object:Gem::Version
88
- version: 1.3.1
89
+ version: '0'
89
90
  requirements: []
90
91
  rubygems_version: 3.1.2
91
92
  signing_key: