allure-rspec 0.8.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +103 -42
- data/lib/allure-rspec.rb +6 -54
- data/lib/allure_rspec/formatter.rb +73 -0
- data/lib/allure_rspec/rspec_model.rb +101 -0
- data/lib/allure_rspec/tag_parser.rb +74 -0
- metadata +27 -66
- data/.gitignore +0 -15
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -49
- data/allure-rspec.gemspec +0 -26
- data/lib/allure-rspec/adaptor.rb +0 -15
- data/lib/allure-rspec/dsl.rb +0 -61
- data/lib/allure-rspec/formatter.rb +0 -117
- data/lib/allure-rspec/hooks.rb +0 -86
- data/lib/allure-rspec/version.rb +0 -5
- data/logo.png +0 -0
- data/spec/another_spec.rb +0 -21
- data/spec/extend_steps_spec.rb +0 -86
- data/spec/hooks_spec.rb +0 -12
- data/spec/issue51_spec.rb +0 -11
- data/spec/nometavalue_spec.rb +0 -11
- data/spec/shared_example_spec.rb +0 -34
- data/spec/spec_helper.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 83dafc0d1f74b972e21c4a8030c9db659a254ff9923e23359932b1697592e1b7
|
4
|
+
data.tar.gz: 7148cac62a99314aed7f2975082c1b00f24e3598ad3c9c7a6b92a678fb312367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48aec78e098d3833f6cc0c99854e5a8034900a5c25244c293cc6316d6824b33ed1a0172177cb590cda1f3207d283f0a74217a0f0bfa30b864b5f580a333e4a75
|
7
|
+
data.tar.gz: bceb2ab63fd823bb4a957970ac61ad5a3e93b8d0de2f251b554c5194902066cee0829019bb99b2afd2e499e529c55c16f0164b24d46f42d37cc07b1978e9a713
|
data/README.md
CHANGED
@@ -1,74 +1,135 @@
|
|
1
|
-
#
|
1
|
+
# allure-rspec
|
2
2
|
|
3
|
-
[
|
3
|
+
Allure adapter for [rspec](https://rspec.info/) testing framework
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Add it to gemfile:
|
8
8
|
|
9
|
-
|
9
|
+
```ruby
|
10
|
+
gem 'allure-rspec'
|
11
|
+
```
|
12
|
+
|
13
|
+
Require in `spec_helper` or any other setup file:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require `allure-rspec`
|
17
|
+
```
|
18
|
+
|
19
|
+
## Configuration
|
10
20
|
|
21
|
+
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)
|
11
22
|
|
12
|
-
##
|
23
|
+
## Usage
|
13
24
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
25
|
+
Via commandline, simply add:
|
26
|
+
|
27
|
+
```bash
|
28
|
+
--format AllureRspecFormatter
|
29
|
+
```
|
30
|
+
|
31
|
+
RSpec configuration:
|
18
32
|
|
19
33
|
```ruby
|
20
|
-
|
34
|
+
RSpec.configure do |c|
|
35
|
+
c.formatter = AllureRspecFormatter
|
36
|
+
end
|
21
37
|
```
|
22
38
|
|
23
|
-
|
39
|
+
### Adding tms links
|
40
|
+
|
41
|
+
Configure tms link pattern:
|
24
42
|
|
25
43
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
-
|
44
|
+
Allure.configure do |c|
|
45
|
+
c.link_tms_pattern = "http://www.jira.com/browse/{}"
|
46
|
+
end
|
29
47
|
```
|
30
48
|
|
31
|
-
|
49
|
+
Add tag to rspec test:
|
32
50
|
|
33
|
-
|
34
|
-
|
51
|
+
```ruby
|
52
|
+
it "some test case", tms: "QA-123" do
|
53
|
+
# test
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
It's possible to add multiple tms links using `tms_` pattern:
|
35
58
|
|
36
59
|
```ruby
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
c.logging_level = Logger::DEBUG # logging level (default: DEBUG)
|
41
|
-
end
|
60
|
+
it "some test case", tms_1: "QA-123", tms_2: "QA-124" do
|
61
|
+
# test
|
62
|
+
end
|
42
63
|
```
|
43
64
|
|
44
|
-
|
65
|
+
### Adding issue links
|
66
|
+
|
67
|
+
Configure issue link pattern:
|
45
68
|
|
46
69
|
```ruby
|
47
|
-
|
70
|
+
Allure.configure do |c|
|
71
|
+
c.link_issue_pattern = "http://www.jira.com/browse/{}"
|
72
|
+
end
|
73
|
+
```
|
48
74
|
|
49
|
-
|
50
|
-
puts "Before step #{s.current_step}"
|
51
|
-
end
|
75
|
+
Add tag to rspec test:
|
52
76
|
|
53
|
-
|
54
|
-
|
55
|
-
|
77
|
+
```ruby
|
78
|
+
it "some test case", issue: "QA-123" do
|
79
|
+
# test
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
It's possible to add multiple tms links using `issue_` pattern:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
it "some test case", issue_1: "QA-123", issue_2: "QA-124" do
|
87
|
+
# test
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
### Adding custom severity and status details
|
92
|
+
|
93
|
+
Test severity (`normal` by default) can be changed via `severity` tag:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
it "some test case", severity: :critical do
|
97
|
+
# test
|
98
|
+
end
|
99
|
+
```
|
56
100
|
|
57
|
-
|
101
|
+
Custom status details can be set via `muted`, `known`, `flaky` tags:
|
58
102
|
|
59
|
-
|
60
|
-
|
61
|
-
|
103
|
+
```ruby
|
104
|
+
it "some test case", flaky: true, muted: false, known: true do
|
105
|
+
# test
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
### Adding additional labels to allure test case
|
110
|
+
|
111
|
+
Additional labels can be added using `allure_` pattern:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
it "some test case", allure_1: "visual_test", allure_2: "core_functionality" do
|
115
|
+
# test
|
116
|
+
end
|
117
|
+
```
|
62
118
|
|
63
|
-
|
64
|
-
5.should be > 0
|
65
|
-
end
|
119
|
+
### Custom actions
|
66
120
|
|
67
|
-
|
68
|
-
|
69
|
-
end
|
121
|
+
Rspec example object has access to [Allure](https://www.rubydoc.info/github/allure-framework/allure-ruby/Allure) helper methods.
|
122
|
+
It can be used to add or run steps, add attachments, modify test case etc.
|
70
123
|
|
71
|
-
|
124
|
+
```ruby
|
125
|
+
it "some test case" do |e|
|
126
|
+
e.run_step("my custom step") do
|
127
|
+
# some action
|
72
128
|
end
|
129
|
+
e.add_attachment(name: "attachment", source: "Some string", type: Allure::ContentType::TXT)
|
73
130
|
end
|
74
131
|
```
|
132
|
+
|
133
|
+
## HTML report generation
|
134
|
+
|
135
|
+
Report is generated using allure commandline tool. [Allure wiki](https://docs.qameta.io/allure/#_reporting).
|
data/lib/allure-rspec.rb
CHANGED
@@ -1,56 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'allure-rspec/formatter'
|
4
|
-
require 'allure-rspec/adaptor'
|
5
|
-
require 'allure-rspec/dsl'
|
6
|
-
require 'allure-rspec/hooks'
|
1
|
+
# rubocop:disable Naming/FileName
|
2
|
+
# frozen_string_literal: true
|
7
3
|
|
8
|
-
|
9
|
-
|
10
|
-
class << self
|
11
|
-
attr_accessor :output_dir
|
12
|
-
attr_accessor :clean_dir
|
13
|
-
attr_accessor :logging_level
|
4
|
+
require "allure-ruby-commons"
|
5
|
+
require "allure_rspec/formatter"
|
14
6
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def output_dir
|
19
|
-
@output_dir || DEFAULT_OUTPUT_DIR
|
20
|
-
end
|
21
|
-
|
22
|
-
def clean_dir?
|
23
|
-
@clean_dir.nil? ? true : @clean_dir
|
24
|
-
end
|
25
|
-
|
26
|
-
def logging_level
|
27
|
-
@logging_level || DEFAULT_LOGGING_LEVEL
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class Context
|
33
|
-
attr_accessor :rspec
|
34
|
-
|
35
|
-
def rspec
|
36
|
-
@rspec
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class << self
|
41
|
-
def context
|
42
|
-
@context ||= Context.new
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class << self
|
47
|
-
def configure(&block)
|
48
|
-
yield Config
|
49
|
-
AllureRubyAdaptorApi.configure { |c|
|
50
|
-
c.output_dir = Config.output_dir
|
51
|
-
c.logging_level = Config.logging_level
|
52
|
-
}
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
7
|
+
AllureRspecFormatter = AllureRspec::RSpecFormatter
|
8
|
+
# rubocop:enable Naming/FileName
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/core"
|
4
|
+
require "rspec/core/formatters/base_formatter"
|
5
|
+
|
6
|
+
require_relative "rspec_model"
|
7
|
+
|
8
|
+
module AllureRspec
|
9
|
+
class RSpecFormatter < RSpec::Core::Formatters::BaseFormatter
|
10
|
+
include AllureRspecModel
|
11
|
+
|
12
|
+
RSpec::Core::Formatters.register(
|
13
|
+
self,
|
14
|
+
:start,
|
15
|
+
:example_group_started,
|
16
|
+
:example_group_finished,
|
17
|
+
:example_started,
|
18
|
+
:example_finished,
|
19
|
+
)
|
20
|
+
|
21
|
+
RSpec::Core::Example.class_eval do
|
22
|
+
Allure.singleton_methods.each do |method|
|
23
|
+
define_method(method) { |*args| Allure.__send__(method, *args) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Start test run
|
28
|
+
# @param [RSpec::Core::Notifications::StartNotification] _start_notification
|
29
|
+
# @return [void]
|
30
|
+
def start(_start_notification)
|
31
|
+
lifecycle.clean_results_dir
|
32
|
+
end
|
33
|
+
|
34
|
+
# Starts example group
|
35
|
+
# @param [RSpec::Core::Notifications::GroupNotification] example_group_notification
|
36
|
+
# @return [void]
|
37
|
+
def example_group_started(example_group_notification)
|
38
|
+
lifecycle.start_test_container(
|
39
|
+
Allure::TestResultContainer.new(name: example_group_notification.group.description),
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Starts example
|
44
|
+
# @param [RSpec::Core::Notifications::ExampleNotification] example_notification
|
45
|
+
# @return [void]
|
46
|
+
def example_started(example_notification)
|
47
|
+
lifecycle.start_test_case(test_result(example_notification.example))
|
48
|
+
end
|
49
|
+
|
50
|
+
# Finishes example
|
51
|
+
# @param [RSpec::Core::Notifications::ExampleNotification] example_notification
|
52
|
+
# @return [void]
|
53
|
+
def example_finished(example_notification)
|
54
|
+
lifecycle.update_test_case(&update_test_proc(example_notification.example.execution_result))
|
55
|
+
lifecycle.stop_test_case
|
56
|
+
end
|
57
|
+
|
58
|
+
# Starts example group
|
59
|
+
# @param [RSpec::Core::Notifications::GroupNotification] example_group_notification
|
60
|
+
# @return [void]
|
61
|
+
def example_group_finished(_example_group_notification)
|
62
|
+
lifecycle.stop_test_container
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# Get thread specific lifecycle
|
68
|
+
# @return [Allure::AllureLifecycle]
|
69
|
+
def lifecycle
|
70
|
+
Allure.lifecycle
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "digest"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
require_relative "tag_parser"
|
7
|
+
|
8
|
+
module AllureRspec
|
9
|
+
module AllureRspecModel
|
10
|
+
include TagParser
|
11
|
+
|
12
|
+
# @return [Hash] allure statuses mapping
|
13
|
+
ALLURE_STATUS ||= {
|
14
|
+
failed: Allure::Status::FAILED,
|
15
|
+
pending: Allure::Status::SKIPPED,
|
16
|
+
passed: Allure::Status::PASSED,
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
# Transform example to <Allure::TestResult>
|
20
|
+
# @param [RSpec::Core::Example] example
|
21
|
+
# @return [Allure::TestResult]
|
22
|
+
def test_result(example)
|
23
|
+
Allure::TestResult.new(
|
24
|
+
name: example.description,
|
25
|
+
description: "Location - #{strip_relative(example.location)}",
|
26
|
+
description_html: "Location - #{strip_relative(example.location)}",
|
27
|
+
history_id: Digest::MD5.hexdigest(example.id),
|
28
|
+
full_name: example.full_description,
|
29
|
+
labels: labels(example),
|
30
|
+
links: links(example),
|
31
|
+
status_details: Allure::StatusDetails.new(**status_detail_tags(example.metadata)),
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Update test status on finish
|
36
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
37
|
+
# @return [Proc]
|
38
|
+
def update_test_proc(result)
|
39
|
+
Allure::ResultUtils.status_details(result.exception).yield_self do |status_detail|
|
40
|
+
proc do |test_case|
|
41
|
+
test_case.stage = Allure::Stage::FINISHED
|
42
|
+
test_case.status = status(result)
|
43
|
+
test_case.status_details.message = status_detail.message
|
44
|
+
test_case.status_details.trace = status_detail.trace
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# @param [RSpec::Core::Example] example
|
52
|
+
# @return [Array<Allure::Label>]
|
53
|
+
def labels(example)
|
54
|
+
[].tap do |labels|
|
55
|
+
labels << Allure::ResultUtils.framework_label("rspec")
|
56
|
+
labels << Allure::ResultUtils.feature_label(example.example_group.description)
|
57
|
+
labels << Allure::ResultUtils.package_label(Pathname.new(strip_relative(example.file_path)).parent.to_s)
|
58
|
+
labels << Allure::ResultUtils.story_label(example.description)
|
59
|
+
labels << Allure::ResultUtils.test_class_label(File.basename(example.file_path, ".rb"))
|
60
|
+
labels << severity(example.metadata)
|
61
|
+
labels.push(*suite_labels(example.example_group))
|
62
|
+
labels.push(*tag_labels(example.metadata))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Add suite labels
|
67
|
+
# @param [RSpec::Core::ExampleGroup] example_group
|
68
|
+
# @return [Array<Allure::Label>]
|
69
|
+
def suite_labels(example_group)
|
70
|
+
example_group.parent_groups.map(&:description).yield_self do |parents|
|
71
|
+
[].tap do |labels|
|
72
|
+
labels << Allure::ResultUtils.suite_label((parents.length == 1) ? parents.last : parents[-2])
|
73
|
+
labels << Allure::ResultUtils.parent_suite_label(parents.last) if parents.length > 1
|
74
|
+
labels << Allure::ResultUtils.sub_suite_label(parents[0..-3].join(" > ")) if parents.length > 2
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# @param [RSpec::Core::Example] example
|
80
|
+
# @return [Array<Allure::Label>]
|
81
|
+
def links(example)
|
82
|
+
tms_links(example.metadata) + issue_links(example.metadata)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Get allure status from result
|
86
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
87
|
+
# @return [Symbol]
|
88
|
+
def status(result)
|
89
|
+
return Allure::ResultUtils.status(result.exception) if result.status == :failed
|
90
|
+
|
91
|
+
ALLURE_STATUS[result.status]
|
92
|
+
end
|
93
|
+
|
94
|
+
# Strip relative ./ form path
|
95
|
+
# @param [String] path
|
96
|
+
# @return [String]
|
97
|
+
def strip_relative(path)
|
98
|
+
path.gsub("./", "")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllureRspec
|
4
|
+
# RSpec custom tag parser
|
5
|
+
module TagParser
|
6
|
+
# Get custom labels
|
7
|
+
# @param [Hash] metadata
|
8
|
+
# @return [Array<Allure::Label>]
|
9
|
+
def tag_labels(metadata)
|
10
|
+
return [] unless Allure::Config.link_tms_pattern && metadata.keys.any? { |k| allure?(k) }
|
11
|
+
|
12
|
+
metadata.select { |k, _v| allure?(k) }.values.map { |v| Allure::ResultUtils.tag_label(v) }
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get tms links
|
16
|
+
# @param [Hash] metadata
|
17
|
+
# @return [Array<Allure::Link>]
|
18
|
+
def tms_links(metadata)
|
19
|
+
return [] unless Allure::Config.link_tms_pattern && metadata.keys.any? { |k| tms?(k) }
|
20
|
+
|
21
|
+
metadata.select { |k, _v| tms?(k) }.values.map { |v| Allure::ResultUtils.tms_link(v) }
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get issue links
|
25
|
+
# @param [Hash] metadata
|
26
|
+
# @return [Array<Allure::Link>]
|
27
|
+
def issue_links(metadata)
|
28
|
+
return [] unless Allure::Config.link_issue_pattern && metadata.keys.any? { |k| issue?(k) }
|
29
|
+
|
30
|
+
metadata.select { |k, _v| issue?(k) }.values.map { |v| Allure::ResultUtils.issue_link(v) }
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get severity
|
34
|
+
# @param [Hash] metadata
|
35
|
+
# @return [String]
|
36
|
+
def severity(metadata)
|
37
|
+
Allure::ResultUtils.severity_label(metadata[:severity] || "normal")
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get status details
|
41
|
+
# @param [Hash] metadata
|
42
|
+
# @return [Hash<Symbol, Boolean>]
|
43
|
+
def status_detail_tags(metadata)
|
44
|
+
{
|
45
|
+
flaky: !!metadata[:flaky],
|
46
|
+
muted: !!metadata[:muted],
|
47
|
+
known: !!metadata[:known],
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
# Does key match custom allure label
|
54
|
+
# @param [Symbol] key
|
55
|
+
# @return [boolean]
|
56
|
+
def allure?(key)
|
57
|
+
key.to_s.match?(/allure(_\d+)?/i)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Does key match tms pattern
|
61
|
+
# @param [Symbol] key
|
62
|
+
# @return [boolean]
|
63
|
+
def tms?(key)
|
64
|
+
key.to_s.match?(/tms(_\d+)?/i)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Does key match issue pattern
|
68
|
+
# @param [Symbol] key
|
69
|
+
# @return [boolean]
|
70
|
+
def issue?(key)
|
71
|
+
key.to_s.match?(/issue(_\d+)?/i)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,101 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.5'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.5'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: allure-ruby-adaptor-api
|
14
|
+
name: allure-ruby-commons
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - '='
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
19
|
+
version: 2.13.1
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - '='
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
26
|
+
version: 2.13.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: rspec-core
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
31
|
+
- - "~>"
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
type: :
|
33
|
+
version: '3.8'
|
34
|
+
type: :runtime
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
|
-
- - "
|
38
|
+
- - "~>"
|
67
39
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description:
|
70
|
-
email:
|
71
|
-
- smecsia@yandex-team.ru
|
40
|
+
version: '3.8'
|
41
|
+
description: Cucumber adaptor to generate rich allure test reports
|
42
|
+
email: andrejs.cunskis@gmail.com
|
72
43
|
executables: []
|
73
44
|
extensions: []
|
74
45
|
extra_rdoc_files: []
|
75
46
|
files:
|
76
|
-
- ".gitignore"
|
77
|
-
- Gemfile
|
78
|
-
- Gemfile.lock
|
79
47
|
- README.md
|
80
|
-
- allure-rspec.gemspec
|
81
48
|
- lib/allure-rspec.rb
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
|
86
|
-
- lib/allure-rspec/version.rb
|
87
|
-
- logo.png
|
88
|
-
- spec/another_spec.rb
|
89
|
-
- spec/extend_steps_spec.rb
|
90
|
-
- spec/hooks_spec.rb
|
91
|
-
- spec/issue51_spec.rb
|
92
|
-
- spec/nometavalue_spec.rb
|
93
|
-
- spec/shared_example_spec.rb
|
94
|
-
- spec/spec_helper.rb
|
95
|
-
homepage: http://allure.qatools.ru
|
49
|
+
- lib/allure_rspec/formatter.rb
|
50
|
+
- lib/allure_rspec/rspec_model.rb
|
51
|
+
- lib/allure_rspec/tag_parser.rb
|
52
|
+
homepage: https://github.com/allure-framework/allure-ruby/tree/master/allure-rspec
|
96
53
|
licenses:
|
97
54
|
- Apache-2.0
|
98
|
-
metadata:
|
55
|
+
metadata:
|
56
|
+
bug_tracker_uri: https://github.com/allure-framework/allure-ruby/issues
|
57
|
+
changelog_uri: https://github.com/allure-framework/allure-ruby/releases
|
58
|
+
documentation_uri: https://github.com/allure-framework/allure-ruby/blob/master/allure-rspec/README.md
|
59
|
+
source_code_uri: https://github.com/allure-framework/allure-ruby/tree/master/allure-rspec
|
60
|
+
wiki_uri: https://github.com/allure-framework/allure-ruby/wiki
|
99
61
|
post_install_message:
|
100
62
|
rdoc_options: []
|
101
63
|
require_paths:
|
@@ -104,16 +66,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
66
|
requirements:
|
105
67
|
- - ">="
|
106
68
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
69
|
+
version: 2.5.0
|
108
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
71
|
requirements:
|
110
72
|
- - ">="
|
111
73
|
- !ruby/object:Gem::Version
|
112
74
|
version: '0'
|
113
75
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.4.8
|
76
|
+
rubygems_version: 3.0.3
|
116
77
|
signing_key:
|
117
78
|
specification_version: 4
|
118
|
-
summary:
|
79
|
+
summary: Allure rspec ruby adaptor
|
119
80
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
allure-rspec (0.8.0)
|
5
|
-
allure-ruby-adaptor-api (= 0.7.0)
|
6
|
-
rspec (~> 3.5)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
allure-ruby-adaptor-api (0.7.0)
|
12
|
-
mimemagic
|
13
|
-
nokogiri (~> 1.7)
|
14
|
-
uuid
|
15
|
-
diff-lcs (1.2.5)
|
16
|
-
macaddr (1.7.1)
|
17
|
-
systemu (~> 2.6.2)
|
18
|
-
mimemagic (0.3.2)
|
19
|
-
mini_portile2 (2.1.0)
|
20
|
-
nokogiri (1.7.0)
|
21
|
-
mini_portile2 (~> 2.1.0)
|
22
|
-
rake (10.4.2)
|
23
|
-
rspec (3.5.0)
|
24
|
-
rspec-core (~> 3.5.0)
|
25
|
-
rspec-expectations (~> 3.5.0)
|
26
|
-
rspec-mocks (~> 3.5.0)
|
27
|
-
rspec-core (3.5.4)
|
28
|
-
rspec-support (~> 3.5.0)
|
29
|
-
rspec-expectations (3.5.0)
|
30
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.5.0)
|
32
|
-
rspec-mocks (3.5.0)
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.5.0)
|
35
|
-
rspec-support (3.5.0)
|
36
|
-
systemu (2.6.5)
|
37
|
-
uuid (2.3.8)
|
38
|
-
macaddr (~> 1.0)
|
39
|
-
|
40
|
-
PLATFORMS
|
41
|
-
ruby
|
42
|
-
|
43
|
-
DEPENDENCIES
|
44
|
-
allure-rspec!
|
45
|
-
bundler
|
46
|
-
rake
|
47
|
-
|
48
|
-
BUNDLED WITH
|
49
|
-
1.13.7
|
data/allure-rspec.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
-
require "allure-rspec/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = 'allure-rspec'
|
7
|
-
s.version = AllureRSpec::Version::STRING
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Ilya Sadykov']
|
10
|
-
s.email = ['smecsia@yandex-team.ru']
|
11
|
-
s.description = %q{Adaptor to use Allure framework along with the RSpec 2}
|
12
|
-
s.summary = "allure-rspec-#{AllureRSpec::Version::STRING}"
|
13
|
-
s.homepage = 'http://allure.qatools.ru'
|
14
|
-
s.license = 'Apache-2.0'
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ['lib']
|
20
|
-
|
21
|
-
s.add_dependency 'rspec', '~> 3.5'
|
22
|
-
s.add_dependency 'allure-ruby-adaptor-api', '0.7.0'
|
23
|
-
|
24
|
-
s.add_development_dependency 'bundler'
|
25
|
-
s.add_development_dependency 'rake'
|
26
|
-
end
|
data/lib/allure-rspec/adaptor.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module AllureRSpec
|
2
|
-
module Adaptor
|
3
|
-
def self.included(base)
|
4
|
-
AllureRSpec.context.rspec = base
|
5
|
-
base.send :include, AllureRSpec::DSL
|
6
|
-
if RSpec::Core::Formatters::Loader.formatters.keys.find_all { |f| f == AllureRSpec::Formatter }.empty?
|
7
|
-
RSpec::Core::Formatters.register AllureRSpec::Formatter, *AllureRSpec::Formatter::NOTIFICATIONS
|
8
|
-
RSpec.configuration.add_formatter(AllureRSpec::Formatter)
|
9
|
-
end
|
10
|
-
RSpec::Core::ExampleGroup.send :include, AllureRSpec::Hooks
|
11
|
-
RSpec::Core::Example.send :include, AllureRSpec::DSL::Example
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
data/lib/allure-rspec/dsl.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'digest'
|
2
|
-
require 'mimemagic'
|
3
|
-
module AllureRSpec
|
4
|
-
module DSL
|
5
|
-
module Example
|
6
|
-
|
7
|
-
def current_step
|
8
|
-
if defined? @@__current_step
|
9
|
-
@@__current_step
|
10
|
-
else
|
11
|
-
nil
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def step(step, &block)
|
16
|
-
suite = __description(metadata[:example_group])
|
17
|
-
test = __description(metadata)
|
18
|
-
begin
|
19
|
-
AllureRubyAdaptorApi::Builder.start_step(suite, test, step)
|
20
|
-
__with_step step, &block
|
21
|
-
AllureRubyAdaptorApi::Builder.stop_step(suite, test, step)
|
22
|
-
rescue Exception => e
|
23
|
-
AllureRubyAdaptorApi::Builder.stop_step(suite, test, step, :failed)
|
24
|
-
raise e
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
def attach_file(title, file, opts = {})
|
30
|
-
suite = __description(metadata[:example_group])
|
31
|
-
test = __description(metadata)
|
32
|
-
step = current_step
|
33
|
-
AllureRubyAdaptorApi::Builder.add_attachment suite, test, opts.merge(:title => title, :file => file, :step => step)
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def __description(data)
|
39
|
-
data[:full_description] || data[:description]
|
40
|
-
end
|
41
|
-
|
42
|
-
def __mutex
|
43
|
-
@@__mutex ||= Mutex.new
|
44
|
-
end
|
45
|
-
|
46
|
-
def __with_step(step, &block)
|
47
|
-
__mutex.synchronize do
|
48
|
-
begin
|
49
|
-
@@__current_step = step
|
50
|
-
AllureRSpec.context.rspec.hooks.send :run, :before, :step, self
|
51
|
-
yield self
|
52
|
-
ensure
|
53
|
-
AllureRSpec.context.rspec.hooks.send :run, :after, :step, self
|
54
|
-
@@__current_step = nil
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'rspec/core' unless defined?(RSpec::Core)
|
2
|
-
require 'rspec/core/formatters/base_formatter' unless defined?(RSpec::Core::Formatters::BaseFormatter)
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module AllureRSpec
|
6
|
-
|
7
|
-
class Formatter < RSpec::Core::Formatters::BaseFormatter
|
8
|
-
|
9
|
-
NOTIFICATIONS = [:example_group_started, :example_group_finished, :example_started,
|
10
|
-
:example_failed, :example_passed, :example_pending, :start, :stop]
|
11
|
-
ALLOWED_LABELS = [:feature, :story, :severity, :language, :framework, :issue, :testId, :host, :thread]
|
12
|
-
|
13
|
-
def example_failed(notification)
|
14
|
-
res = notification.example.execution_result
|
15
|
-
status = res.exception.is_a?(RSpec::Expectations::ExpectationNotMetError) ? :failed : :broken
|
16
|
-
stop_test(notification.example, :exception => res.exception, :status => status)
|
17
|
-
end
|
18
|
-
|
19
|
-
def example_group_finished(notification)
|
20
|
-
AllureRubyAdaptorApi::Builder.stop_suite(description(notification.group).to_s)
|
21
|
-
end
|
22
|
-
|
23
|
-
def example_group_started(notification)
|
24
|
-
AllureRubyAdaptorApi::Builder.start_suite(description(notification.group).to_s, labels(notification))
|
25
|
-
end
|
26
|
-
|
27
|
-
def example_passed(notification)
|
28
|
-
stop_test(notification.example)
|
29
|
-
end
|
30
|
-
|
31
|
-
def example_pending(notification)
|
32
|
-
stop_test(notification.example)
|
33
|
-
end
|
34
|
-
|
35
|
-
def example_started(notification)
|
36
|
-
suite = description(notification.example.example_group).to_s
|
37
|
-
test = description(notification.example).to_s
|
38
|
-
AllureRubyAdaptorApi::Builder.start_test(suite, test, labels(notification))
|
39
|
-
end
|
40
|
-
|
41
|
-
def start(example_count)
|
42
|
-
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
43
|
-
if AllureRSpec::Config.clean_dir?
|
44
|
-
puts "Cleaning output directory '#{dir}'..."
|
45
|
-
FileUtils.rm_rf(dir)
|
46
|
-
end
|
47
|
-
FileUtils.mkdir_p(dir)
|
48
|
-
end
|
49
|
-
|
50
|
-
def stop(notify)
|
51
|
-
AllureRubyAdaptorApi::Builder.build!
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def description(data, attr = :full_description)
|
57
|
-
((((data.respond_to?(attr)) ?
|
58
|
-
data.send(attr) : data.metadata[attr]) ||
|
59
|
-
description(data, :description)) || '').strip
|
60
|
-
end
|
61
|
-
|
62
|
-
def stop_test(example, opts = {})
|
63
|
-
res = example.execution_result
|
64
|
-
AllureRubyAdaptorApi::Builder.stop_test(
|
65
|
-
description(example.example_group).to_s,
|
66
|
-
(example.metadata[:description_args].size== 0) ? description(example.example_group) : description(example).to_s,
|
67
|
-
{
|
68
|
-
:status => res.status,
|
69
|
-
:finished_at => res.finished_at,
|
70
|
-
:started_at => res.started_at
|
71
|
-
}.merge(opts)
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
def metadata(example_or_group)
|
76
|
-
group?(example_or_group) ?
|
77
|
-
example_or_group.group.metadata :
|
78
|
-
example_or_group.example.metadata
|
79
|
-
end
|
80
|
-
|
81
|
-
def group?(example_or_group)
|
82
|
-
(example_or_group.respond_to? :group)
|
83
|
-
end
|
84
|
-
|
85
|
-
def labels(example_or_group)
|
86
|
-
labels = ALLOWED_LABELS.map { |label| [label, metadata(example_or_group)[label]] }.
|
87
|
-
find_all { |value| !value[1].nil? }.
|
88
|
-
inject({}) { |res, value| res.merge(value[0] => value[1]) }
|
89
|
-
detect_feature_story(labels, example_or_group)
|
90
|
-
labels
|
91
|
-
end
|
92
|
-
|
93
|
-
def method_or_key(metadata, key)
|
94
|
-
metadata.respond_to?(key) ? metadata.send(key) : metadata[key]
|
95
|
-
end
|
96
|
-
|
97
|
-
def detect_feature_story(labels, example_or_group)
|
98
|
-
metadata = metadata(example_or_group)
|
99
|
-
is_group = group?(example_or_group)
|
100
|
-
parent = (method_or_key(metadata, :parent_example_group))
|
101
|
-
if labels[:feature] === true
|
102
|
-
description = (!is_group && parent) ? method_or_key(parent, :description) : method_or_key(metadata, :description)
|
103
|
-
labels[:feature] = description
|
104
|
-
if labels[:story] === true
|
105
|
-
if parent
|
106
|
-
grandparent = parent && method_or_key(parent, :parent_example_group)
|
107
|
-
labels[:feature] = (!is_group && grandparent) ? method_or_key(grandparent, :description) :
|
108
|
-
method_or_key(parent, :description)
|
109
|
-
end
|
110
|
-
labels[:story] = description
|
111
|
-
end
|
112
|
-
end
|
113
|
-
labels
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
end
|
data/lib/allure-rspec/hooks.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
module AllureRSpec
|
2
|
-
module Hooks
|
3
|
-
|
4
|
-
def self.included(cls)
|
5
|
-
cls.extend OverrideHooksMethods
|
6
|
-
end
|
7
|
-
|
8
|
-
module OverrideHooksMethods
|
9
|
-
include RSpec::Core::Hooks
|
10
|
-
|
11
|
-
alias_method :old_hooks, :hooks
|
12
|
-
|
13
|
-
def hooks
|
14
|
-
@__hooks ||= OverridenHookCollections.new(old_hooks)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
class OverridenHookCollections < RSpec::Core::Hooks::HookCollections
|
20
|
-
def initialize(original)
|
21
|
-
super(original.instance_eval("@owner"), original.instance_eval("@filterable_item_repo_class"))
|
22
|
-
[:@before_example_hooks, :@after_example_hooks, :@before_context_hooks, :@after_context_hooks, :@around_example_hooks].each { |var|
|
23
|
-
instance_variable_set(var, original.instance_eval("#{var}"))
|
24
|
-
}
|
25
|
-
@before_step_hooks = nil
|
26
|
-
@after_step_hooks = nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def run(position, scope, example_or_group)
|
30
|
-
if scope == :step
|
31
|
-
run_owned_hooks_for(position, scope, example_or_group)
|
32
|
-
else
|
33
|
-
super
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
protected
|
38
|
-
|
39
|
-
# TODO: This code is highly related to the RSpec internals.
|
40
|
-
# It should be supported with every new RSpec version
|
41
|
-
def matching_hooks_for(position, scope, example_or_group)
|
42
|
-
if scope == :step
|
43
|
-
repo = hooks_for(position, scope) || example_or_group.example_group.hooks.hooks_for(position, scope)
|
44
|
-
metadata = case example_or_group
|
45
|
-
when RSpec::Core::ExampleGroup then
|
46
|
-
example_or_group.class.metadata
|
47
|
-
else
|
48
|
-
example_or_group.metadata
|
49
|
-
end
|
50
|
-
repo.nil? ? EMPTY_HOOK_ARRAY : repo.items_for(metadata)
|
51
|
-
else
|
52
|
-
super
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def hooks_for(position, scope)
|
57
|
-
if scope == :step
|
58
|
-
position == :before ? @before_step_hooks : @after_step_hooks
|
59
|
-
else
|
60
|
-
super
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def ensure_hooks_initialized_for(position, scope)
|
65
|
-
if scope == :step
|
66
|
-
if position == :before
|
67
|
-
@before_step_hooks ||= @filterable_item_repo_class.new(:all?)
|
68
|
-
else
|
69
|
-
@after_step_hooks ||= @filterable_item_repo_class.new(:all?)
|
70
|
-
end
|
71
|
-
else
|
72
|
-
super
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
SCOPES = [:example, :context, :step]
|
77
|
-
|
78
|
-
def known_scope?(scope)
|
79
|
-
SCOPES.include?(scope) || super(scope)
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
data/lib/allure-rspec/version.rb
DELETED
data/logo.png
DELETED
Binary file
|
data/spec/another_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
describe "Some another spec", :feature => ["Some Feature"], :severity => :normal do
|
5
|
-
|
6
|
-
before(:suite) do
|
7
|
-
puts "before suite"
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:suite) do
|
11
|
-
puts "after suite"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "10 cannot be greater than 19", :story => ["Some story"], :testId => 10 do
|
15
|
-
expect(10).to be > 19
|
16
|
-
end
|
17
|
-
|
18
|
-
it "4 must not be equal to 5", :testId => 20 do
|
19
|
-
expect(5).to be eql(4)
|
20
|
-
end
|
21
|
-
end
|
data/spec/extend_steps_spec.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
describe AllureRSpec, :feature => "Basics" do
|
5
|
-
|
6
|
-
before(:suite) do
|
7
|
-
puts "before suite"
|
8
|
-
end
|
9
|
-
|
10
|
-
before(:context) do
|
11
|
-
puts "before context"
|
12
|
-
end
|
13
|
-
|
14
|
-
before(:step) do |s|
|
15
|
-
puts "before step #{s.current_step}"
|
16
|
-
end
|
17
|
-
|
18
|
-
before(:example) do
|
19
|
-
puts "before example"
|
20
|
-
end
|
21
|
-
|
22
|
-
after(:step) do |s|
|
23
|
-
puts "after step #{s.current_step}"
|
24
|
-
end
|
25
|
-
|
26
|
-
after(:example) do
|
27
|
-
puts "after example"
|
28
|
-
end
|
29
|
-
|
30
|
-
after(:suite) do
|
31
|
-
puts "after suite"
|
32
|
-
end
|
33
|
-
|
34
|
-
after(:context) do
|
35
|
-
puts "after all"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should build", :story => "Main story" do |e|
|
39
|
-
e.attach_file "test-file1", Tempfile.new("test")
|
40
|
-
e.step "step1" do |step|
|
41
|
-
step.attach_file "test-file2", Tempfile.new("test")
|
42
|
-
end
|
43
|
-
|
44
|
-
e.step "step2" do |step|
|
45
|
-
step.attach_file "logo", File.new("logo.png")
|
46
|
-
expect(5).to be > 1
|
47
|
-
end
|
48
|
-
|
49
|
-
e.step "step3" do
|
50
|
-
expect(0).to eq(1)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should be failed example" do
|
55
|
-
fail_spec "Failure"
|
56
|
-
end
|
57
|
-
|
58
|
-
def fail_spec(desc)
|
59
|
-
raise RSpec::Expectations::ExpectationNotMetError.new(desc)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should raise exception" do |e|
|
63
|
-
|
64
|
-
e.step "step1" do
|
65
|
-
expect(5).to be > 1
|
66
|
-
end
|
67
|
-
|
68
|
-
e.step "step2" do
|
69
|
-
raise "Undesired exception"
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
it "is a pending example"
|
75
|
-
|
76
|
-
context "some context" do
|
77
|
-
it do |e|
|
78
|
-
expect("aa").to eq("aa")
|
79
|
-
end
|
80
|
-
|
81
|
-
it do |e|
|
82
|
-
expect(5).to eq(6)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
data/spec/hooks_spec.rb
DELETED
data/spec/issue51_spec.rb
DELETED
data/spec/nometavalue_spec.rb
DELETED
data/spec/shared_example_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require "set"
|
3
|
-
|
4
|
-
shared_examples_for "a collection" do
|
5
|
-
let(:collection) { described_class.new([7, 2, 4]) }
|
6
|
-
|
7
|
-
context "initialized with 3 items" do
|
8
|
-
it "says it has three items" do
|
9
|
-
expect(collection.size).to be 3
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#include?" do
|
14
|
-
context "with an an item that is in the collection" do
|
15
|
-
it "returns true" do
|
16
|
-
expect(collection.include?(7)).to be true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with an an item that is not in the collection" do
|
21
|
-
it "returns false" do
|
22
|
-
expect(collection.include?(9)).to be false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Array do
|
29
|
-
it_behaves_like "a collection"
|
30
|
-
end
|
31
|
-
|
32
|
-
describe Set do
|
33
|
-
it_behaves_like "a collection"
|
34
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'allure-rspec'
|
3
|
-
require 'nokogiri'
|
4
|
-
|
5
|
-
RSpec.configure do |c|
|
6
|
-
c.include AllureRSpec::Adaptor
|
7
|
-
|
8
|
-
c.before(:suite) do
|
9
|
-
puts 'Before Suite Spec helper'
|
10
|
-
end
|
11
|
-
|
12
|
-
c.before(:all) do
|
13
|
-
puts 'Before all Spec helper'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
AllureRSpec.configure do |c|
|
18
|
-
c.output_dir = "allure"
|
19
|
-
end
|
20
|
-
|