allure-ruby-commons 2.13.2 → 2.13.3

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: 34bd95847a64b20e7599bf9e31d1dea65c03b1d161c0c93065c6c17ec93b21e4
4
- data.tar.gz: 2720242585f11632fc7210ab296f680a7c9928f844e68af016c9f28ffe83c5a3
3
+ metadata.gz: 63f3f8681c7437dcc8be0da1a0da44ba238d3103b56f6146746ae910d38ed76d
4
+ data.tar.gz: e0a6e79db8e67121bfe250c1bc576d18dcbeb1bfa5f3679513dba37759d97d64
5
5
  SHA512:
6
- metadata.gz: c4d9fb6e73b70e3c93053b4167e12f5f5a1ef2f18288b5b934e92f1e35ec1a29afad6bff1bb86a72f7571640a1e2b899b324e33a8fd179e4762c47156f711d74
7
- data.tar.gz: f018a79ecba6691ebefa373b82d6b79ac68da29f1da7e8e0176c591c03551b5d714848700e0b3e1d35789ece55940f8c7160a7f2c86e69f1a00c3e8ae465f6c8
6
+ metadata.gz: 3e6d27dc40e461f96695f5c7a93ad9b27bdd12982ea77e669aad7d5dc3fb76bec86149fe267124bcf1711a153bda175f44ae5f80f872723035bc714d7a20e361
7
+ data.tar.gz: d0905aa7da8b94c983614db9f7693cfa7c37e8fca7655eb4b40084fe650e92f00883c4158d83adbcb5c2c7608bd5e5604c62e7cd0b6733e9d8d7d2aaef2cdf2e
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Allure Ruby Adaptor API
2
+
2
3
  [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/gems/allure-ruby-commons)
3
4
 
4
5
  This is a helper library containing the basics for any ruby-based Allure adaptor.
@@ -138,13 +138,20 @@ 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
141
+ # Add allure report environment info
142
142
  # @param [Hash<Symbol, String>] environment
143
143
  # @return [void]
144
144
  def add_environment(environment)
145
145
  lifecycle.write_environment(environment)
146
146
  end
147
147
 
148
+ # Add categories info
149
+ # @param [File, Array<Allure::Category>] categories
150
+ # @return [void]
151
+ def add_categories(categories)
152
+ lifecycle.write_categories(categories)
153
+ end
154
+
148
155
  # Add step with provided name and optional status to current test step, fixture or test case
149
156
  # @param [String] name
150
157
  # @param [Symbol] status <Allure::Status>, <Allure::Status::PASSED> by default
@@ -13,7 +13,7 @@ module Allure
13
13
  @step_context = []
14
14
  end
15
15
 
16
- def_delegators :file_writer, :write_attachment, :write_environment
16
+ def_delegators :file_writer, :write_attachment, :write_environment, :write_categories
17
17
 
18
18
  # Start test result container
19
19
  # @param [Allure::TestResultContainer] test_result_container
@@ -9,6 +9,10 @@ module Allure
9
9
  TEST_RESULT_CONTAINER_SUFFIX = "-container.json"
10
10
  # @return [String] attachment file suffix
11
11
  ATTACHMENT_FILE_SUFFIX = "-attachment"
12
+ # @return [String] environment info file
13
+ ENVIRONMENT_FILE = "environment.properties"
14
+ # @return [String] categories definition json
15
+ CATEGORIES_FILE = "categories.json"
12
16
 
13
17
  # Write test result
14
18
  # @param [Allure::TestResult] test_result
@@ -37,7 +41,18 @@ module Allure
37
41
  # @return [void]
38
42
  def write_environment(environment)
39
43
  environment.reduce("") { |e, (k, v)| e + "#{k}=#{v}\n" }.tap do |env|
40
- write("environment.properties", env)
44
+ write(ENVIRONMENT_FILE, env)
45
+ end
46
+ end
47
+
48
+ # Write categories info
49
+ # @param [File, Array<Allure::Category>] categories
50
+ # @return [void]
51
+ def write_categories(categories)
52
+ if categories.is_a?(File)
53
+ copy(categories.path, CATEGORIES_FILE)
54
+ else
55
+ write(CATEGORIES_FILE, categories.to_json)
41
56
  end
42
57
  end
43
58
 
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "jsonable"
4
+
5
+ module Allure
6
+ class Category < JSONable
7
+ # Defects category
8
+ # @param [String] name
9
+ # @param [Array<Allure::Status>] matched_statuses
10
+ # @param [String, Regexp] message_regex
11
+ # @param [String, Regexp] trace_regex
12
+ def initialize(name:, matched_statuses: nil, message_regex: nil, trace_regex: nil)
13
+ @name = name
14
+ @matched_statuses = matched_statuses
15
+ @message_regex = message_regex
16
+ @trace_regex = trace_regex
17
+ end
18
+ end
19
+ end
@@ -7,5 +7,6 @@ module Allure
7
7
  BROKEN = :broken
8
8
  PASSED = :passed
9
9
  SKIPPED = :skipped
10
+ UNKNOWN = :unknown
10
11
  end
11
12
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "jsonable"
4
+
4
5
  module Allure
5
6
  # Allure model step result container
6
7
  class TestResultContainer < JSONable
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.2
4
+ version: 2.13.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: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uuid
@@ -91,6 +91,7 @@ files:
91
91
  - lib/allure_ruby_commons/config.rb
92
92
  - lib/allure_ruby_commons/file_writer.rb
93
93
  - lib/allure_ruby_commons/model/attachment.rb
94
+ - lib/allure_ruby_commons/model/category.rb
94
95
  - lib/allure_ruby_commons/model/content_type.rb
95
96
  - lib/allure_ruby_commons/model/executable_item.rb
96
97
  - lib/allure_ruby_commons/model/fixture_result.rb