spec_selector 0.1.7 → 0.1.8
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.tar.gz.sig +0 -0
- metadata +10 -27
- metadata.gz.sig +0 -0
- data/CHANGELOG.md +0 -9
- 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: d5ebcfc2cf3d1b1779bab9de9470bf160c00566c830cebaf290c44f26ba7351b
|
|
4
|
+
data.tar.gz: e80c880103bf8f7cc80701804fe227bff7d3c4de6cad50208c31a00ae6924ec4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0a033f8cdc4a013e303ddfb00e942c117cca3a887792be54e7cc04e63561eb836f88b1e728b8fb7845fc2f9a6979a926d061df9d75f1db098a5de4e203e410d
|
|
7
|
+
data.tar.gz: f463910ca22286b2b605d08d29894004bdea3319e4f4c6b6b89412400a1dfb0576406ee76bbadf068d706638e655c0b7b007c2a512ca4cda523e417023319353
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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.8
|
|
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
|
- |
|
|
@@ -34,28 +34,22 @@ cert_chain:
|
|
|
34
34
|
2oaEU1xxH+4n3qzECM32PIry9QVrTud/3/ouDLy4LVVyutD5ZANsVQrr0y8vEA6+
|
|
35
35
|
OXcnI0Yc8EI4dmIAwDI0ZfBo2OgFBxNJCeurVx36tUPsSWjJUd0BeA==
|
|
36
36
|
-----END CERTIFICATE-----
|
|
37
|
-
date: 2021-
|
|
37
|
+
date: 2021-12-29 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,9 +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.
|
|
5
|
-
|
|
6
|
-
**version 0.1.7**
|
|
7
|
-
<br>
|
|
8
|
-
<br>
|
|
9
|
-
Updated key control instructions display text.
|
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
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
describe 'SpecSelectorUtil::DataMap' do
|
|
2
|
-
subject(:spec_selector) { SpecSelector.new(StringIO.new) }
|
|
3
|
-
|
|
4
|
-
let(:example_group) { build(:example_group) }
|
|
5
|
-
|
|
6
|
-
let(:map) { spec_selector.ivar(:@map) }
|
|
7
|
-
|
|
8
|
-
describe '#top_level_push' do
|
|
9
|
-
before { spec_selector.top_level_push(example_group) }
|
|
10
|
-
|
|
11
|
-
it 'lazy-initializes @map[:top_level] to an array' do
|
|
12
|
-
expect(map[:top_level]).to be_an(Array)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'stores example group in @map[:top_level]' do
|
|
16
|
-
expect(map[:top_level]).to include(example_group)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# takes takes the metadata hash from an example group or from an
|
|
21
|
-
# example as its argument
|
|
22
|
-
describe '#parent_data' do
|
|
23
|
-
context 'when metadata hash is from an example' do
|
|
24
|
-
let(:example_metadata) { { example_group: example_group.metadata } }
|
|
25
|
-
let(:example) { instance_double('Example', metadata: example_metadata) }
|
|
26
|
-
|
|
27
|
-
it 'returns metadata of the example group to which the example belongs' do
|
|
28
|
-
expect(spec_selector.parent_data(example_metadata))
|
|
29
|
-
.to eq(example_group.metadata)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context 'when metadata hash is from an example group' do
|
|
34
|
-
context 'when the example group has a parent group' do
|
|
35
|
-
let(:example_group) do
|
|
36
|
-
instance_double('ExampleGroup', metadata: {
|
|
37
|
-
parent_example_group: { block: :parent_example_block }
|
|
38
|
-
})
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'returns the parent group metadata' do
|
|
42
|
-
expect(spec_selector.parent_data(example_group.metadata))
|
|
43
|
-
.to eq(example_group.metadata[:parent_example_group])
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
context 'when the example group does not have a parent group' do
|
|
48
|
-
it 'returns nil' do
|
|
49
|
-
expect(spec_selector.parent_data(example_group.metadata)).to be_nil
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe '#map_group' do
|
|
56
|
-
let(:map) { spec_selector.ivar(:@map) }
|
|
57
|
-
|
|
58
|
-
before { spec_selector.map_group(example_group) }
|
|
59
|
-
|
|
60
|
-
context 'when example group has parent group' do
|
|
61
|
-
let(:example_group) do
|
|
62
|
-
instance_double('ExampleGroup', metadata: {
|
|
63
|
-
parent_example_group: { block: :parent_block }
|
|
64
|
-
})
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it 'stores the parent block as a key in @map initialized to an array' do
|
|
68
|
-
expect(map[:parent_block]).to be_an(Array)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'stores the example group in the parent block array' do
|
|
72
|
-
expect(map[:parent_block]).to include(example_group)
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context 'when example group does not have parent group' do
|
|
77
|
-
it 'passes the example group to #top_level_push' do
|
|
78
|
-
expect(map[:top_level]).to include(example_group)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe '#map_example' do
|
|
84
|
-
let(:example) do
|
|
85
|
-
build(:example, example_group: example_group)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
before do
|
|
89
|
-
map[example_group.metadata[:block]] = []
|
|
90
|
-
example_group.examples << example
|
|
91
|
-
spec_selector.map_example(example)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it 'appends the example to its example group in @map' do
|
|
95
|
-
expect(map[example_group.metadata[:block]]).to include(example)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|