spec_selector 0.1.6 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,222 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'SpecSelectorUtil::Helpers' do
|
4
|
-
include_context 'shared'
|
5
|
-
|
6
|
-
describe '#all_passing?' do
|
7
|
-
context 'when all examples have passed' do
|
8
|
-
before { ivars_set({ :@pass_count => 10, :@fail_count => 0, :@pending_count => 0 }) }
|
9
|
-
|
10
|
-
it 'returns true' do
|
11
|
-
expect(spec_selector.all_passing?).to be true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'when not all examples have passed' do
|
16
|
-
before { ivars_set({ :@pass_count => 5, :@fail_count => 5, :@pending_count => 5 }) }
|
17
|
-
|
18
|
-
it 'returns false' do
|
19
|
-
expect(spec_selector.all_passing?).to be false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#none_passing?' do
|
25
|
-
context 'when no examples have passed' do
|
26
|
-
before { ivars_set({ :@pass_count => 0, :@fail_count => 5, :@pending_count => 5 }) }
|
27
|
-
|
28
|
-
it 'returns true' do
|
29
|
-
expect(spec_selector.none_passing?).to be true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when at least one example has passed' do
|
34
|
-
before { ivars_set({ :@pass_count => 1, :@fail_count => 4, :@pending_count => 5 }) }
|
35
|
-
|
36
|
-
it 'returns false' do
|
37
|
-
expect(spec_selector.none_passing?).to be false
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#all_passed?' do
|
43
|
-
context 'when every example in argument array has passed' do
|
44
|
-
let(:examples) { pass_group.examples }
|
45
|
-
|
46
|
-
it 'returns true' do
|
47
|
-
expect(spec_selector.all_passed?(examples)).to be true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'when at least one example in argument array did not pass' do
|
52
|
-
let(:examples) { mixed_result_group.examples }
|
53
|
-
|
54
|
-
it 'returns false' do
|
55
|
-
expect(spec_selector.all_passed?(examples)).to be false
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#any_failed?' do
|
61
|
-
context 'when at least one example in argument array has failed' do
|
62
|
-
let(:examples) { fail_group.examples }
|
63
|
-
|
64
|
-
it 'returns true' do
|
65
|
-
expect(spec_selector.any_failed?(examples)).to be true
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when no examples in argument array have failed' do
|
70
|
-
let(:examples) { pass_group.examples }
|
71
|
-
|
72
|
-
it 'returns false' do
|
73
|
-
expect(spec_selector.any_failed?(examples)).to be false
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#any_pending?' do
|
79
|
-
context 'when at least one example has pending status' do
|
80
|
-
let(:examples) { mixed_result_group.examples }
|
81
|
-
|
82
|
-
it 'returns true' do
|
83
|
-
expect(spec_selector.any_pending?(examples)).to be true
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
context 'when no examples have pending status' do
|
88
|
-
let(:examples) { fail_group.examples }
|
89
|
-
|
90
|
-
it 'returns false' do
|
91
|
-
expect(spec_selector.any_pending?(examples)).to be false
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '#example?' do
|
97
|
-
context 'when argument is an instance of RSpec::Core::Example' do
|
98
|
-
let(:example) { build(:example) }
|
99
|
-
|
100
|
-
it 'returns true' do
|
101
|
-
expect(spec_selector.example?(example)).to be true
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'when argument is not an instance of RSpec::Core::Example' do
|
106
|
-
let(:non_example) { build(:example_group) }
|
107
|
-
|
108
|
-
it 'returns false' do
|
109
|
-
expect(spec_selector.example?(non_example)).to be false
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#status' do
|
115
|
-
it 'returns the execution result status of example' do
|
116
|
-
expect(spec_selector.status(passing_example)).to eq(:passed)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe '#description_mode?' do
|
121
|
-
context 'when @filter_mode is set to :description' do
|
122
|
-
before { spec_selector.ivar_set(:@filter_mode, :description) }
|
123
|
-
|
124
|
-
it 'returns true' do
|
125
|
-
expect(spec_selector.description_mode?).to be true
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'when @filter_mode is not set to :description' do
|
130
|
-
before { spec_selector.ivar_set(:@filter_mode, :location) }
|
131
|
-
|
132
|
-
it 'returns false' do
|
133
|
-
expect(spec_selector.description_mode?).to be false
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe '#location_mode?' do
|
139
|
-
context 'when @filter_mode is set to :location' do
|
140
|
-
before { spec_selector.ivar_set(:@filter_mode, :location) }
|
141
|
-
|
142
|
-
it 'returns true' do
|
143
|
-
expect(spec_selector.location_mode?).to be true
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context 'when @filter_mode is not set to :location' do
|
148
|
-
before { spec_selector.ivar_set(:@filter_mode, :description) }
|
149
|
-
|
150
|
-
it 'returns false' do
|
151
|
-
expect(spec_selector.location_mode?).to be false
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe '#empty_line' do
|
157
|
-
it 'prints an newline character' do
|
158
|
-
spec_selector.empty_line
|
159
|
-
expect(output).to eq("\n")
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe '#top_level?' do
|
164
|
-
context 'when current list is a top-level list' do
|
165
|
-
before { ivars_set(:@active_map => mixed_map, :@list => mixed_map[:top_level]) }
|
166
|
-
|
167
|
-
it 'returns true' do
|
168
|
-
expect(spec_selector.top_level?).to be true
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
context 'when current list is not a top-level list' do
|
173
|
-
before { ivars_set(:@active_map => mixed_map, :@list => mixed_map[fail_group.metadata[:block]]) }
|
174
|
-
|
175
|
-
it 'returns false' do
|
176
|
-
expect(spec_selector.top_level?).to be false
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
describe '#filter_view?' do
|
182
|
-
context 'when current list is inclusion filter' do
|
183
|
-
before { ivars_set(:@inclusion_filter => fail_group.examples, :@list => fail_group.examples) }
|
184
|
-
|
185
|
-
it 'returns true' do
|
186
|
-
expect(spec_selector.filter_view?).to be true
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
context 'when current list is not inclusion filter' do
|
191
|
-
before { ivars_set(:@inclusion_filter => fail_group.examples, :@list => pass_group.examples) }
|
192
|
-
|
193
|
-
it 'returns false' do
|
194
|
-
expect(spec_selector.filter_view?).to be false
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
describe '#current_path' do
|
200
|
-
it 'returns the absolute path to directory that contains the current file' do
|
201
|
-
expect(spec_selector.current_path).to match(%r{spec_selector/lib/spec_selector$})
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
describe '#one_liner?' do
|
206
|
-
context 'when the argument is an example written in descriptionless (one-liner) syntax' do
|
207
|
-
let(:example) { build(:example, metadata: { description_args: [] }) }
|
208
|
-
|
209
|
-
it 'returns true' do
|
210
|
-
expect(spec_selector.one_liner?(example)).to be true
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
context 'when the argument is a described example' do
|
215
|
-
let(:example) { build(:example, metadata: { description_args: ['is a described example'] }) }
|
216
|
-
|
217
|
-
it 'returns false' do
|
218
|
-
expect(spec_selector.one_liner?(example)).to be false
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SpecSelectorUtil::Initialize do
|
4
|
-
# the subject calls #initialze_all during initialization, which calls
|
5
|
-
# all of the other methods in this block.
|
6
|
-
subject(:spec_selector) { SpecSelector.new(StringIO.new) }
|
7
|
-
|
8
|
-
describe '#init_example_store' do
|
9
|
-
it 'initializes @failed to an empty array' do
|
10
|
-
expect(spec_selector.ivar(:@failed)).to eq([])
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'initializes @passed to an empty array' do
|
14
|
-
expect(spec_selector.ivar(:@passed)).to eq([])
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'initializes @pending to an empty array' do
|
18
|
-
expect(spec_selector.ivar(:@pending)).to eq([])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#init_summaries' do
|
23
|
-
it 'initializes @failure_summaries to an empty hash' do
|
24
|
-
expect(spec_selector.ivar(:@failure_summaries)).to eq({})
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'initializes @pending_summaries to an empty hash' do
|
28
|
-
expect(spec_selector.ivar(:@pending_summaries)).to eq({})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#init_counters' do
|
33
|
-
it 'initializes @pass_count to zero' do
|
34
|
-
expect(spec_selector.ivar(:@pass_count)).to eq(0)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'initializes @fail_count to zero' do
|
38
|
-
expect(spec_selector.ivar(:@fail_count)).to eq(0)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'initializes @pending_count to zero' do
|
42
|
-
expect(spec_selector.ivar(:@pending_count)).to eq(0)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#init_pass_inclusion' do
|
47
|
-
it 'initializes @exclude_passing to false' do
|
48
|
-
expect(spec_selector.ivar(:@exclude_passing)).to eq(false)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#init_map' do
|
53
|
-
let(:map) { spec_selector.ivar(:@map) }
|
54
|
-
|
55
|
-
it 'initializes @groups to an empty hash' do
|
56
|
-
expect(spec_selector.ivar(:@groups)).to eq({})
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'initializes @map to an empty hash' do
|
60
|
-
expect(map).to eq({})
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'initializes @active_map to @map' do
|
64
|
-
expect(spec_selector.ivar(:@active_map)).to eq(map)
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'initializes @list to nil' do
|
68
|
-
expect(spec_selector.ivar(:@list)).to be_nil
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe '#init_selector' do
|
73
|
-
it 'initializes @selected to nil' do
|
74
|
-
expect(spec_selector.ivar(:@selected)).to be_nil
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'initialzes @selector_index to zero' do
|
78
|
-
expect(spec_selector.ivar(:@selector_index)).to eq(0)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# #initialize_all calls the above methods and initializes the
|
83
|
-
# instance variables tested below.
|
84
|
-
describe '#initialize_all' do
|
85
|
-
it 'initializes @messages to an empty array' do
|
86
|
-
expect(spec_selector.ivar(:@messages)).to eq([])
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'initializes @instructions to false' do
|
90
|
-
expect(spec_selector.ivar(:@instructions)).to eq(false)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|