spec_selector 0.1.6 → 0.1.9
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/spec_selector/instructions.rb +1 -1
- data.tar.gz.sig +4 -5
- metadata +31 -48
- metadata.gz.sig +0 -0
- data/CHANGELOG.md +0 -4
- data/spec/factories.rb +0 -89
- data/spec/shared.rb +0 -145
- data/spec/spec_helper.rb +0 -47
- data/spec/spec_selector_spec.rb +0 -165
- data/spec/spec_selector_util/data_map_spec.rb +0 -98
- data/spec/spec_selector_util/data_presentation_spec.rb +0 -314
- data/spec/spec_selector_util/format_spec.rb +0 -213
- data/spec/spec_selector_util/helpers_spec.rb +0 -222
- data/spec/spec_selector_util/initialize_spec.rb +0 -93
- data/spec/spec_selector_util/ui_spec.rb +0 -459
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bc35307d09216051323403138065f3970a1d14d6037b7637b373776d93368aa
|
4
|
+
data.tar.gz: e3e3a425a985f4a42d3cb198710fb8404dd5d590e0d76156de8e8632df1a06d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc580481d6aea4d71f3a97d9692f0b66894956842f91f84b72eee80af900e84013d55458ed21aab09e92b846bf76b5bba57590d6ed734db86eaf6cd8eb8be468
|
7
|
+
data.tar.gz: 9638c80ac47b1af9d20cb0bea87580b8e88267cd3b6380cbf44f5984e401a78115f17e7818b7980f2f4d6a8ec0d47fac2d4b842e9e110226557c71b03dc0be7f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
�
|
5
|
-
M�����5�3�&��[��ʪ�N*`�)6��Fѕ�3W�������9ĝc��$�
|
1
|
+
��� � ���e�O�)u�,��$�4�Xy���� �5���]ఙZ���G��mU a:}(e�9�
|
2
|
+
�)<$J*uc�{aMd���
|
3
|
+
y�y���K�,kr
|
4
|
+
�:�hߡ���>�PPg$(��sB��V1�鷴%BY�[@Uճ�%�_�o�~#x�hI*>�<��K}o�0��Pd�V*'lN2��ΰ�D/vϕ�b�Cgk �E�����2�)��+i~�yi�h��пqD���K����Q�$��CU%��z��Q�EM���1LL�d+2���9�oj�t�J&��b� *h*s��
|
metadata
CHANGED
@@ -1,61 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec_selector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Almon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIERDCCAqygAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBt0cmV2
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
b3JhbG1vbi9EQz1nbWFpbC9EQz1jb20wHhcNMjIwMzAyMDAzMjQwWhcNMjMwMzAy
|
15
|
+
MDAzMjQwWjAmMSQwIgYDVQQDDBt0cmV2b3JhbG1vbi9EQz1nbWFpbC9EQz1jb20w
|
16
|
+
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC991w77ymk5K8hNyWjpNXb
|
17
|
+
g8vZjDAeeXvqDTW2Qiib804BXirW/wiRDN3vmgBMim+RsPk2h0dqqIw9nXo6bltC
|
18
|
+
XmXBtt0jn0W1+6lwfQWbFYeqaynr9zg2nwrMi6yzMXrYuRz8BI94lQM9y+9q626s
|
19
|
+
hDl/+7hknubMUCnEjjdwTsq2r/zyBzoy0iesxTtHvWhKs/XLl3xHh43LKFExWLT0
|
20
|
+
qg3+KrECp02/hXr++Yxwjf03tXPmMMCl1o7NY1WjQpQxbenlCjiejvcG+Xo0lR61
|
21
|
+
VJqghwndXfWk0lLJ7dbINzlUmMjDtxCEc/fF9tKcGtW8pS7D2s4sO+I2k32d+dd/
|
22
|
+
677l0F/+ujvotIi2B39Joc1SfxxQ/Pd+izLTXY2eIOs22B7JFpwgp4tWXgbsXtYQ
|
23
|
+
qI3noTyr+nAdcC+KqdjT4MpGPiw5MUNDKvdqPZiMyLjvPQeLe7TsHinnzyw1xIaZ
|
24
|
+
PKJUEzdKZrtJV4GzodbgyZR9uEfyx+PAD+HwOFMlECkCAwEAAaN9MHswCQYDVR0T
|
25
|
+
BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFDbKkK7+ln19sIsAvooygdyRSb7L
|
26
26
|
MCAGA1UdEQQZMBeBFXRyZXZvcmFsbW9uQGdtYWlsLmNvbTAgBgNVHRIEGTAXgRV0
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
cmV2b3JhbG1vbkBnbWFpbC5jb20wDQYJKoZIhvcNAQELBQADggGBADYg8Y0J/6nm
|
28
|
+
VPjuoH9wPtuyJjty1dyem0mJqGvgl3FdEFVuxp9jHXHdaR6viM7Xe2oHZB9295cA
|
29
|
+
qJ3bFonUaPvF5oOz+pVhgzOL/MS7kkMKV1PN78vhtMq6Fefg2r5hZFJcYbAzx0Tb
|
30
|
+
9sefD5XaymN+udddtp2ZYlwjC2YpnfizST94UP0NAQzPScOcxTfUFQAuh9dOaVob
|
31
|
+
Bsq5ahzpoft599L7ZijLhHb5eAOWoD2aG/TvG3nHP1BwVNzer81wwy/YV77kLWXv
|
32
|
+
hp5TJEsnGUFWdh3nBuoPIA4q7LIx9Y3hUBtZqnHdD0dfFH+Wa56wncTWwX7xNZMk
|
33
|
+
kWGyWUsnHi3aztuOqHYx2N9/5sQ6LUW5XCG+RdAhbRjg3fRw7kFgiIEbEiibo8da
|
34
|
+
k2Xgy2eWwGKB1H5GYaooq8yKpbWcQT160/4gh9OJc7AINqlFNkKdv2FWcjoqE+Ht
|
35
|
+
cbztMoJB1BmhofTWwU3/JKv/sWKXKzd6caHY7GVAxbwluQ5J7CUPfw==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
37
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: rspec
|
41
41
|
requirement: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 3.0
|
46
|
-
- - "<"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '4'
|
45
|
+
version: '3.0'
|
49
46
|
type: :runtime
|
50
47
|
prerelease: false
|
51
48
|
version_requirements: !ruby/object:Gem::Requirement
|
52
49
|
requirements:
|
53
|
-
- - "
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 3.0.0
|
56
|
-
- - "<"
|
50
|
+
- - "~>"
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
version: '
|
52
|
+
version: '3.0'
|
59
53
|
description: " SpecSelector is an RSpec formatter that opens a utility \n menu in
|
60
54
|
your terminal window when you run tests (rather \n than just printing static text).
|
61
55
|
The utility allows you to \n select, view, filter, and rerun specific test results
|
@@ -65,7 +59,6 @@ executables: []
|
|
65
59
|
extensions: []
|
66
60
|
extra_rdoc_files: []
|
67
61
|
files:
|
68
|
-
- CHANGELOG.md
|
69
62
|
- README.md
|
70
63
|
- lib/spec_selector.rb
|
71
64
|
- lib/spec_selector/data_map.rb
|
@@ -79,16 +72,6 @@ files:
|
|
79
72
|
- lib/spec_selector/terminal.rb
|
80
73
|
- lib/spec_selector/ui.rb
|
81
74
|
- license.md
|
82
|
-
- spec/factories.rb
|
83
|
-
- spec/shared.rb
|
84
|
-
- spec/spec_helper.rb
|
85
|
-
- spec/spec_selector_spec.rb
|
86
|
-
- spec/spec_selector_util/data_map_spec.rb
|
87
|
-
- spec/spec_selector_util/data_presentation_spec.rb
|
88
|
-
- spec/spec_selector_util/format_spec.rb
|
89
|
-
- spec/spec_selector_util/helpers_spec.rb
|
90
|
-
- spec/spec_selector_util/initialize_spec.rb
|
91
|
-
- spec/spec_selector_util/ui_spec.rb
|
92
75
|
homepage: https://github.com/TrevorA-TrevorA/spec_selector
|
93
76
|
licenses:
|
94
77
|
- MIT
|
@@ -96,7 +79,7 @@ metadata:
|
|
96
79
|
source_code_uri: https://github.com/TrevorA-TrevorA/spec_selector
|
97
80
|
homepage_uri: https://github.com/TrevorA-TrevorA/spec_selector
|
98
81
|
changelog_uri: https://github.com/TrevorA-TrevorA/spec_selector/blob/master/CHANGELOG.md
|
99
|
-
post_install_message:
|
82
|
+
post_install_message:
|
100
83
|
rdoc_options: []
|
101
84
|
require_paths:
|
102
85
|
- lib
|
@@ -111,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
94
|
- !ruby/object:Gem::Version
|
112
95
|
version: '0'
|
113
96
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
97
|
+
rubygems_version: 3.2.21
|
98
|
+
signing_key:
|
116
99
|
specification_version: 4
|
117
100
|
summary: A results viewer and filter utility for RSpec
|
118
101
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
**version 0.1.6**
|
2
|
-
<br>
|
3
|
-
<br>
|
4
|
-
Corrected a test rerun bug as well as a problem with key control regex patterns; made a slight modification to key controls: T is no longer case-sensitive and will now rerun the top failed test result from the current set. To view the top failed result from the current set without rerunning, press SPACEBAR.
|
data/spec/factories.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TestObjects
|
4
|
-
RSN = RSpec::Core::Notifications
|
5
|
-
|
6
|
-
class Example < RSpec::Core::Example
|
7
|
-
attr_accessor :metadata, :execution_result, :description, :example_group
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class ExecutionResult < RSpec::Core::Example::ExecutionResult
|
14
|
-
attr_accessor :status
|
15
|
-
end
|
16
|
-
|
17
|
-
class ExampleGroup < RSpec::Core::ExampleGroup
|
18
|
-
attr_accessor :examples, :metadata, :description
|
19
|
-
end
|
20
|
-
|
21
|
-
class SummaryNotification < RSN::SummaryNotification
|
22
|
-
attr_accessor :example_count,
|
23
|
-
:duration,
|
24
|
-
:load_time,
|
25
|
-
:errors_outside_of_example_count
|
26
|
-
|
27
|
-
:examples
|
28
|
-
end
|
29
|
-
|
30
|
-
class SkippedExampleNotification < RSN::SkippedExampleNotification
|
31
|
-
attr_accessor :example
|
32
|
-
|
33
|
-
def fully_formatted(_)
|
34
|
-
"\npending example"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class FailedExampleNotification < RSN::FailedExampleNotification
|
39
|
-
attr_accessor :example
|
40
|
-
|
41
|
-
def initialize
|
42
|
-
end
|
43
|
-
|
44
|
-
def fully_formatted(_)
|
45
|
-
"\nfailed example"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
FactoryBot.define do
|
51
|
-
factory :execution_result, class: 'TestObjects::ExecutionResult' do
|
52
|
-
status { :passed }
|
53
|
-
end
|
54
|
-
|
55
|
-
factory :example, class: 'TestObjects::Example' do
|
56
|
-
execution_result { build(:execution_result) }
|
57
|
-
description { 'passed' }
|
58
|
-
metadata { {} }
|
59
|
-
end
|
60
|
-
|
61
|
-
factory :example_group, class: 'TestObjects::ExampleGroup' do
|
62
|
-
examples { [build(:example)] }
|
63
|
-
metadata { { block: self } }
|
64
|
-
description do
|
65
|
-
if examples.all? { |ex| ex.execution_result.status == :passed }
|
66
|
-
'passing example group'
|
67
|
-
else
|
68
|
-
'non-passing example group'
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
factory :summary_notification, class: 'TestObjects::SummaryNotification' do
|
74
|
-
example_count { 25 }
|
75
|
-
duration { 1.5 }
|
76
|
-
load_time { 0.5 }
|
77
|
-
errors_outside_of_examples_count { 0 }
|
78
|
-
end
|
79
|
-
|
80
|
-
factory :skipped_example_notification,
|
81
|
-
class: 'TestObjects::SkippedExampleNotification' do
|
82
|
-
example
|
83
|
-
end
|
84
|
-
|
85
|
-
factory :failed_example_notification,
|
86
|
-
class: 'TestObjects::FailedExampleNotification' do
|
87
|
-
example
|
88
|
-
end
|
89
|
-
end
|
data/spec/shared.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
RSpec.shared_context 'shared' do
|
2
|
-
let(:spec_selector) { SpecSelector.new(StringIO.new) }
|
3
|
-
let(:output) { spec_selector.ivar(:@output).string }
|
4
|
-
let(:fail_result) { build(:execution_result, status: :failed) }
|
5
|
-
let(:pending_result) { build(:execution_result, status: :pending) }
|
6
|
-
let(:failed_example) { build(:example, execution_result: fail_result, metadata: { description: 'failed_example' }) }
|
7
|
-
let(:pending_example) do
|
8
|
-
build(:example, execution_result: pending_result, metadata: { description: 'pending_example' })
|
9
|
-
end
|
10
|
-
let(:passing_example) do
|
11
|
-
build(:example, metadata: { description: 'passing_example' }, description: 'passing_example')
|
12
|
-
end
|
13
|
-
let(:pass_group) do
|
14
|
-
build(:example_group, examples: [build(:example), build(:example)], metadata: { description: 'pass_group' })
|
15
|
-
end
|
16
|
-
let(:fail_group) { build(:example_group, examples: [failed_example, failed_example]) }
|
17
|
-
let(:pending_group) do
|
18
|
-
build(:example_group, examples: [pending_example, pending_example], metadata: { description: 'pending_group' })
|
19
|
-
end
|
20
|
-
let(:mixed_result_group) { build(:example_group, examples: [passing_example, failed_example, pending_example]) }
|
21
|
-
let(:fail_subgroup) do
|
22
|
-
build(
|
23
|
-
:example_group,
|
24
|
-
metadata: {
|
25
|
-
parent_example_group: {}
|
26
|
-
},
|
27
|
-
examples: [failed_example, failed_example]
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:pending_subgroup) do
|
32
|
-
build(
|
33
|
-
:example_group,
|
34
|
-
metadata: {
|
35
|
-
parent_example_group: {}
|
36
|
-
},
|
37
|
-
examples: [pending_example, pending_example]
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
let(:fail_parent_group) { build(:example_group, examples: [], metadata: { description: 'fail_parent_group' }) }
|
42
|
-
let(:pending_parent_group) { build(:example_group, examples: [], metadata: { description: 'pending_parent_group' }) }
|
43
|
-
let(:pass_subgroup) do
|
44
|
-
build(
|
45
|
-
:example_group,
|
46
|
-
metadata: { parent_example_group: pass_parent_group.metadata, description: 'pass_subgroup' },
|
47
|
-
examples: [passing_example, passing_example]
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
let(:pass_parent_group) { build(:example_group, examples: [], metadata: { description: 'pass_parent_group' }) }
|
52
|
-
let(:mixed_list) { [pass_group, fail_group] }
|
53
|
-
let(:mixed_map) do
|
54
|
-
{
|
55
|
-
:top_level => [pass_group, fail_group],
|
56
|
-
pass_group.metadata[:block] => pass_group.examples,
|
57
|
-
fail_group.metadata[:block] => fail_group.examples
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
let(:pending_map) do
|
62
|
-
{
|
63
|
-
:top_level => [pending_group],
|
64
|
-
pending_group.metadata[:block] => pending_group.examples
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
let(:deep_map) do
|
69
|
-
{
|
70
|
-
:top_level => [pending_parent_group, pass_parent_group, fail_parent_group],
|
71
|
-
pending_parent_group.metadata[:block] => [pending_subgroup],
|
72
|
-
pass_parent_group.metadata[:block] => [pass_subgroup],
|
73
|
-
fail_parent_group.metadata[:block] => [fail_subgroup],
|
74
|
-
pending_subgroup.metadata[:block] => pending_subgroup.examples,
|
75
|
-
pass_subgroup.metadata[:block] => pass_subgroup.examples,
|
76
|
-
fail_subgroup.metadata[:block] => fail_subgroup.examples
|
77
|
-
}
|
78
|
-
end
|
79
|
-
|
80
|
-
let(:all_passing_map) do
|
81
|
-
{
|
82
|
-
top_level: [pass_group, pass_group],
|
83
|
-
pass_group.metadata[:block] => pass_group.examples,
|
84
|
-
pass_group.metadata[:block] => pass_group.examples
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
def allow_methods(*methods)
|
89
|
-
methods.each do |method|
|
90
|
-
allow(spec_selector).to receive(method)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def ivars_set(ivar_hash)
|
95
|
-
ivar_hash.each do |ivar, value|
|
96
|
-
spec_selector.ivar_set(ivar, value)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def ivar_set(sym, value)
|
101
|
-
spec_selector.ivar_set(sym, value)
|
102
|
-
end
|
103
|
-
|
104
|
-
def ivar(sym)
|
105
|
-
spec_selector.ivar(sym)
|
106
|
-
end
|
107
|
-
|
108
|
-
def more_data?(readable)
|
109
|
-
IO.select([readable], nil, nil, 0.000001)
|
110
|
-
end
|
111
|
-
|
112
|
-
def summary_settings(example)
|
113
|
-
case example
|
114
|
-
when failed_example
|
115
|
-
notification_type = :failed_example_notification
|
116
|
-
summary_list = :@failure_summaries
|
117
|
-
ivar = :@failed
|
118
|
-
when pending_example
|
119
|
-
notification_type = :skipped_example_notification
|
120
|
-
summary_list = :@pending_summaries
|
121
|
-
ivar = :@pending
|
122
|
-
end
|
123
|
-
|
124
|
-
ivars_set(:@selected => example, ivar => [example])
|
125
|
-
notification = build(notification_type, example: example)
|
126
|
-
spec_selector.ivar(summary_list)[example] = notification
|
127
|
-
end
|
128
|
-
|
129
|
-
def expect_full_instructions_to_be_displayed
|
130
|
-
expect(output).to include('Press I to hide instructions')
|
131
|
-
expect(output).to include('Press F to exclude passing examples')
|
132
|
-
expect(output).to include('Press ↑ or ↓ to navigate list')
|
133
|
-
expect(output).to include('Press [enter] to select')
|
134
|
-
expect(output).to include('Press Q to exit')
|
135
|
-
end
|
136
|
-
|
137
|
-
def expect_full_instructions_to_be_hidden
|
138
|
-
expect(output).to include('Press I to view instructions')
|
139
|
-
expect(output).not_to include('Press I to hide instructions')
|
140
|
-
expect(output).not_to include('Press F to exclude passing examples')
|
141
|
-
expect(output).not_to include('Press ↑ or ↓ to navigate list')
|
142
|
-
expect(output).not_to include('Press [enter] to select')
|
143
|
-
expect(output).not_to include('Press Q to exit')
|
144
|
-
end
|
145
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_selector'
|
4
|
-
require 'stringio'
|
5
|
-
require 'factory_bot'
|
6
|
-
require 'timeout'
|
7
|
-
require 'shared'
|
8
|
-
|
9
|
-
RCN = RSpec::Core::Notifications
|
10
|
-
EXAMPLE_STUBS = { description: 'description',
|
11
|
-
execution_result: 'result',
|
12
|
-
full_description: 'full_description' }.freeze
|
13
|
-
|
14
|
-
alias ivar instance_variable_get
|
15
|
-
alias ivar_set instance_variable_set
|
16
|
-
|
17
|
-
RSpec.configure do |config|
|
18
|
-
config.expect_with :rspec do |expectations|
|
19
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
20
|
-
end
|
21
|
-
|
22
|
-
config.filter_run_when_matching :focus
|
23
|
-
|
24
|
-
config.mock_with :rspec do |mocks|
|
25
|
-
mocks.verify_partial_doubles = true
|
26
|
-
end
|
27
|
-
|
28
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
29
|
-
|
30
|
-
config.include_context 'shared', include_shared: true
|
31
|
-
|
32
|
-
config.include FactoryBot::Syntax::Methods
|
33
|
-
|
34
|
-
config.before(:suite) do
|
35
|
-
FactoryBot.find_definitions
|
36
|
-
end
|
37
|
-
|
38
|
-
config.around(:example, break_loop: true) do |example|
|
39
|
-
begin
|
40
|
-
Timeout.timeout(0.001) do
|
41
|
-
example.run
|
42
|
-
end
|
43
|
-
rescue Timeout::Error
|
44
|
-
nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/spec/spec_selector_spec.rb
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SpecSelector do
|
4
|
-
include_context 'shared'
|
5
|
-
|
6
|
-
let(:spec_selector) { described_class.new(StringIO.new) }
|
7
|
-
|
8
|
-
let(:output) { spec_selector.ivar(:@output).string }
|
9
|
-
let(:pass_result) { build(:execution_result) }
|
10
|
-
let(:pending_result) { build(:execution_result, status: :pending) }
|
11
|
-
|
12
|
-
let(:fail_result) do
|
13
|
-
build(:execution_result, status: :failed, exception: 'error')
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#message' do
|
17
|
-
let(:notification) { RCN::MessageNotification.new('message') }
|
18
|
-
|
19
|
-
it 'stores the message string in the @messages array' do
|
20
|
-
messages = spec_selector.ivar(:@messages)
|
21
|
-
spec_selector.message(notification)
|
22
|
-
expect(messages).to include('message')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#example_group_started' do
|
27
|
-
let(:group) do
|
28
|
-
instance_double('ExampleGroup', metadata: { block: 'key' }, examples: [])
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:notification) { RCN::GroupNotification.new(group) }
|
32
|
-
|
33
|
-
it 'passes the example group to SpecSelector#map_group' do
|
34
|
-
expect(spec_selector).to receive(:map_group).with(group)
|
35
|
-
spec_selector.example_group_started(notification)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'stores example group in the @groups hash' do
|
39
|
-
spec_selector.example_group_started(notification)
|
40
|
-
groups = spec_selector.ivar(:@groups)
|
41
|
-
expect(groups.values).to include(group)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#example_passed' do
|
46
|
-
let(:example) { instance_double('Example', execution_result: pass_result) }
|
47
|
-
let(:notification) { RCN::ExampleNotification.send(:new, example) }
|
48
|
-
|
49
|
-
before do
|
50
|
-
allow(spec_selector).to receive(:map_example)
|
51
|
-
allow(spec_selector).to receive(:check_inclusion_status)
|
52
|
-
spec_selector.example_passed(notification)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'stores example in @passed array' do
|
56
|
-
passed = spec_selector.ivar(:@passed)
|
57
|
-
expect(passed).to include(example)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'increments @pass_count' do
|
61
|
-
pass_count = spec_selector.ivar(:@pass_count)
|
62
|
-
expect(pass_count).to eq(1)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'updates passing example status display' do
|
66
|
-
expect(output).to match(/PASS: \d+/)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#example_pending' do
|
71
|
-
let(:example) { instance_double('Example', execution_result: pending_result) }
|
72
|
-
let(:notification) { RCN::ExampleNotification.send(:new, example) }
|
73
|
-
|
74
|
-
before do
|
75
|
-
allow(spec_selector).to receive(:map_example)
|
76
|
-
allow(spec_selector).to receive(:check_inclusion_status)
|
77
|
-
spec_selector.example_pending(notification)
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'stores example in @pending array' do
|
81
|
-
pending = spec_selector.ivar(:@pending)
|
82
|
-
expect(pending).to include(notification.example)
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'increments @pending_count' do
|
86
|
-
pending_count = spec_selector.ivar(:@pending_count)
|
87
|
-
expect(pending_count).to eq(1)
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'updates pending status display' do
|
91
|
-
expect(output).to match(/PENDING: \d+/)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe '#example_failed' do
|
96
|
-
let(:example) do
|
97
|
-
instance_double('Example',
|
98
|
-
full_description: 'full description',
|
99
|
-
execution_result: fail_result)
|
100
|
-
end
|
101
|
-
|
102
|
-
let(:notification) { RCN::FailedExampleNotification.send(:new, example) }
|
103
|
-
|
104
|
-
before do
|
105
|
-
allow(spec_selector).to receive(:map_example)
|
106
|
-
allow(spec_selector).to receive(:check_inclusion_status)
|
107
|
-
spec_selector.example_failed(notification)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'stores example in @failed array' do
|
111
|
-
failed = spec_selector.ivar(:@failed)
|
112
|
-
expect(failed).to include(notification.example)
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'increments @fail_count' do
|
116
|
-
fail_count = spec_selector.ivar(:@fail_count)
|
117
|
-
expect(fail_count).to eq(1)
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'calls #status_count' do
|
121
|
-
expect(output).to match(/FAIL: \d+/)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe '#dump_summary', break_loop: true do
|
126
|
-
let(:notification) { build(:summary_notification) }
|
127
|
-
|
128
|
-
context 'when errors outside of examples have occurred' do
|
129
|
-
let(:notification) do
|
130
|
-
build(:summary_notification, errors_outside_of_examples_count: 2)
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'passes notification to #print_errors' do
|
134
|
-
allow(spec_selector).to receive(:print_errors).and_call_original
|
135
|
-
spec_selector.dump_summary(notification)
|
136
|
-
expect(spec_selector).to have_received(:print_errors).with(notification)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context 'when errors outside of examples have not occured' do
|
141
|
-
it 'does not call #print_errors' do
|
142
|
-
allow(spec_selector).to receive(:print_errors).and_call_original
|
143
|
-
spec_selector.dump_summary(notification)
|
144
|
-
expect(spec_selector).not_to have_received(:print_errors)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'when non-error messages are present with no examples' do
|
149
|
-
it 'calls #messages only' do
|
150
|
-
spec_selector.ivar(:@messages) << 'some message'
|
151
|
-
spec_selector.dump_summary(notification)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context 'when examples successfully executed' do
|
156
|
-
it 'passes notification to #examples_summary' do
|
157
|
-
ivar_set(:@map, mixed_map)
|
158
|
-
allow(spec_selector).to receive(:examples_summary).and_call_original
|
159
|
-
spec_selector.dump_summary(notification)
|
160
|
-
expect(spec_selector).to have_received(:examples_summary)
|
161
|
-
.with(notification)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|