rspeed 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +11 -7
- data/lib/generators/rspeed/install_generator.rb +1 -1
- data/lib/rspeed.rb +8 -6
- data/lib/rspeed/env.rb +43 -0
- data/lib/rspeed/extension.rb +3 -2
- data/lib/rspeed/observer.rb +17 -3
- data/lib/rspeed/redis.rb +55 -0
- data/lib/rspeed/runner.rb +3 -18
- data/lib/rspeed/splitter.rb +29 -52
- data/lib/rspeed/variable.rb +31 -0
- data/lib/rspeed/version.rb +1 -1
- data/spec/common_helper.rb +10 -0
- data/spec/fixtures/empty.rb +4 -0
- data/spec/models/rspeed/env/db_spec.rb +17 -0
- data/spec/models/rspeed/env/host_spec.rb +17 -0
- data/spec/models/rspeed/env/name_spec.rb +17 -0
- data/spec/models/rspeed/env/pipe_spec.rb +19 -0
- data/spec/models/rspeed/env/pipes_spec.rb +41 -0
- data/spec/models/rspeed/env/port_spec.rb +17 -0
- data/spec/models/rspeed/env/result_key_spec.rb +19 -0
- data/spec/models/rspeed/env/rspeed_spec.rb +43 -0
- data/spec/models/rspeed/env/tmp_spec.rb +19 -0
- data/spec/models/rspeed/observer/after_spec.rb +0 -2
- data/spec/models/rspeed/observer/after_suite_spec.rb +46 -0
- data/spec/models/rspeed/observer/before_spec.rb +0 -2
- data/spec/models/rspeed/observer/before_suite_spec.rb +24 -2
- data/spec/models/rspeed/redis/clean_pipes_flag_spec.rb +14 -0
- data/spec/models/rspeed/redis/client_spec.rb +7 -0
- data/spec/models/rspeed/redis/destroy_spec.rb +29 -0
- data/spec/models/rspeed/redis/get_spec.rb +9 -0
- data/spec/models/rspeed/redis/keys_spec.rb +29 -0
- data/spec/models/rspeed/redis/result_spec.rb +13 -0
- data/spec/models/rspeed/redis/set_spec.rb +9 -0
- data/spec/models/rspeed/redis/specs_finished_spec.rb +19 -0
- data/spec/models/rspeed/redis/specs_initiated_spec.rb +13 -0
- data/spec/models/rspeed/runner/run_spec.rb +30 -0
- data/spec/models/rspeed/splitter/actual_examples_spec.rb +6 -2
- data/spec/models/rspeed/splitter/append_spec.rb +1 -3
- data/spec/models/rspeed/splitter/diff_spec.rb +1 -3
- data/spec/models/rspeed/splitter/first_pipe_spec.rb +2 -4
- data/spec/models/rspeed/splitter/get_spec.rb +7 -9
- data/spec/models/rspeed/splitter/pipe_files_spec.rb +26 -0
- data/spec/models/rspeed/splitter/redundant_run_spec.rb +45 -0
- data/spec/models/rspeed/splitter/rename_spec.rb +3 -5
- data/spec/models/rspeed/splitter/split_spec.rb +70 -34
- data/spec/models/rspeed/variable/append_name_spec.rb +19 -0
- data/spec/models/rspeed/variable/csv_spec.rb +5 -0
- data/spec/models/rspeed/variable/default_partner_spec.rb +5 -0
- data/spec/models/rspeed/variable/key_spec.rb +15 -0
- data/spec/models/rspeed/variable/pipe_name_spec.rb +15 -0
- data/spec/models/rspeed/variable/pipes_pattern_spec.rb +5 -0
- data/spec/models/rspeed/variable/result_spec.rb +19 -0
- data/spec/models/rspeed/variable/tmp_spec.rb +15 -0
- data/spec/{rails_helper.rb → spec_helper.rb} +2 -22
- data/spec/support/common.rb +13 -0
- data/spec/support/coverage.rb +14 -0
- data/spec/support/env_mock.rb +3 -0
- data/spec/support/fakeredis.rb +3 -0
- metadata +137 -20
- data/spec/models/rspeed/splitter/destroy_spec.rb +0 -33
- data/spec/models/rspeed/splitter/keys_spec.rb +0 -33
- data/spec/models/rspeed/splitter/last_pipe_spec.rb +0 -21
- data/spec/models/rspeed/splitter/pipe_spec.rb +0 -21
- data/spec/models/rspeed/splitter/pipes_spec.rb +0 -27
- data/spec/models/rspeed/splitter/result_spec.rb +0 -19
- data/spec/models/rspeed/splitter/save_spec.rb +0 -57
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'support/env_mock'
|
4
|
+
|
5
|
+
RSpec.describe RSpeed::Variable, '.append_name' do
|
6
|
+
context 'when env name is given' do
|
7
|
+
it 'appends the rspeed name on the given value' do
|
8
|
+
EnvMock.mock(rspeed_name: 'name') do
|
9
|
+
expect(described_class.append_name('value')).to eq('value_name')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when env name is not given' do
|
15
|
+
it 'ignores the suffix' do
|
16
|
+
expect(described_class.append_name('value')).to eq('value')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'support/env_mock'
|
4
|
+
|
5
|
+
RSpec.describe RSpeed::Variable, '.key' do
|
6
|
+
it { expect(described_class.key(1)).to be(:rspeed_1) }
|
7
|
+
|
8
|
+
context 'when env name is given' do
|
9
|
+
it 'includes the name' do
|
10
|
+
EnvMock.mock(rspeed_name: 'name') do
|
11
|
+
expect(described_class.key(1)).to be(:rspeed_name_1)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'support/env_mock'
|
4
|
+
|
5
|
+
RSpec.describe RSpeed::Variable, '.pipe_name' do
|
6
|
+
it { expect(described_class.pipe_name).to eq('rspeed_pipe_1') }
|
7
|
+
|
8
|
+
context 'when env name is given' do
|
9
|
+
it 'includes the name' do
|
10
|
+
EnvMock.mock(rspeed_name: 'name') do
|
11
|
+
expect(described_class.pipe_name).to eq('rspeed_pipe_name_1')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'support/env_mock'
|
4
|
+
|
5
|
+
RSpec.describe RSpeed::Variable, '.result' do
|
6
|
+
it { expect(described_class.result).to eq('rspeed') }
|
7
|
+
|
8
|
+
context 'when env name is given' do
|
9
|
+
it 'includes the name' do
|
10
|
+
EnvMock.mock(rspeed_name: 'name') do
|
11
|
+
expect(described_class.result).to eq('rspeed_name')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when env name is not given' do
|
17
|
+
it { expect(described_class.result).to eq('rspeed') }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'support/env_mock'
|
4
|
+
|
5
|
+
RSpec.describe RSpeed::Variable, '.tmp' do
|
6
|
+
it { expect(described_class.tmp).to eq('rspeed_tmp') }
|
7
|
+
|
8
|
+
context 'when env name is given' do
|
9
|
+
it 'includes the name' do
|
10
|
+
EnvMock.mock(rspeed_name: 'name') do
|
11
|
+
expect(described_class.tmp).to eq('rspeed_tmp_name')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,25 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
ENV['RAILS_ENV'] ||= 'test'
|
4
|
-
|
5
|
-
require 'fakeredis/rspec'
|
6
|
-
require 'json'
|
7
|
-
require 'pry-byebug'
|
8
|
-
require 'rspec'
|
9
|
-
require 'rspeed'
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.after do
|
13
|
-
ENV.delete('RSPEED_PIPE')
|
14
|
-
ENV.delete('RSPEED_PIPES')
|
15
|
-
end
|
16
|
-
|
17
|
-
config.disable_monkey_patching!
|
18
|
-
|
19
|
-
config.order = :random
|
20
|
-
config.profile_examples = 10
|
21
|
-
end
|
22
|
-
|
23
3
|
def delete_file(file_path = 'rspeed.csv')
|
24
4
|
File.delete(file_path) if File.exist?(file_path)
|
25
5
|
end
|
@@ -36,12 +16,12 @@ def populate_csv_file
|
|
36
16
|
'0.7,./spec/0_7_spec.rb',
|
37
17
|
'0.4,./spec/0_4_spec.rb',
|
38
18
|
'0.3,./spec/0_3_spec.rb',
|
39
|
-
'0.2,./spec/0_2_spec.rb'
|
19
|
+
'0.2,./spec/0_2_spec.rb',
|
40
20
|
].join("\n")
|
41
21
|
|
42
22
|
File.open('rspeed.csv', 'a') { |file| file.write(data) }
|
43
23
|
end
|
44
24
|
|
45
25
|
def redis_object
|
46
|
-
@redis_object ||= Redis.new(db:
|
26
|
+
@redis_object ||= Redis.new(db: RSpeed::Env.db, host: RSpeed::Env.host)
|
47
27
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if ENV['COVERAGE'] == 'true'
|
4
|
+
require 'simplecov'
|
5
|
+
require 'codecov'
|
6
|
+
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
8
|
+
|
9
|
+
SimpleCov.minimum_coverage(ENV.fetch('MINIMUM_COVERAGE', 80).to_i)
|
10
|
+
|
11
|
+
SimpleCov.start('rails') do
|
12
|
+
add_filter('vendor')
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Washington Botelho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
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: env_mock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: fakeredis
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +109,21 @@ dependencies:
|
|
67
109
|
- !ruby/object:Gem::Version
|
68
110
|
version: '0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
112
|
+
name: rubocop-performance
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rails
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
129
|
- - ">="
|
@@ -109,32 +165,64 @@ files:
|
|
109
165
|
- lib/generators/rspeed/install_generator.rb
|
110
166
|
- lib/generators/rspeed/templates/lib/tasks/rspeed.rb
|
111
167
|
- lib/rspeed.rb
|
168
|
+
- lib/rspeed/env.rb
|
112
169
|
- lib/rspeed/extension.rb
|
113
170
|
- lib/rspeed/observer.rb
|
171
|
+
- lib/rspeed/redis.rb
|
114
172
|
- lib/rspeed/runner.rb
|
115
173
|
- lib/rspeed/splitter.rb
|
174
|
+
- lib/rspeed/variable.rb
|
116
175
|
- lib/rspeed/version.rb
|
176
|
+
- spec/common_helper.rb
|
117
177
|
- spec/fixtures/1_spec.rb
|
118
178
|
- spec/fixtures/2_spec.rb
|
179
|
+
- spec/fixtures/empty.rb
|
119
180
|
- spec/fixtures/new_spec.rb.csv
|
181
|
+
- spec/models/rspeed/env/db_spec.rb
|
182
|
+
- spec/models/rspeed/env/host_spec.rb
|
183
|
+
- spec/models/rspeed/env/name_spec.rb
|
184
|
+
- spec/models/rspeed/env/pipe_spec.rb
|
185
|
+
- spec/models/rspeed/env/pipes_spec.rb
|
186
|
+
- spec/models/rspeed/env/port_spec.rb
|
187
|
+
- spec/models/rspeed/env/result_key_spec.rb
|
188
|
+
- spec/models/rspeed/env/rspeed_spec.rb
|
189
|
+
- spec/models/rspeed/env/tmp_spec.rb
|
120
190
|
- spec/models/rspeed/observer/after_spec.rb
|
191
|
+
- spec/models/rspeed/observer/after_suite_spec.rb
|
121
192
|
- spec/models/rspeed/observer/before_spec.rb
|
122
193
|
- spec/models/rspeed/observer/before_suite_spec.rb
|
194
|
+
- spec/models/rspeed/redis/clean_pipes_flag_spec.rb
|
195
|
+
- spec/models/rspeed/redis/client_spec.rb
|
196
|
+
- spec/models/rspeed/redis/destroy_spec.rb
|
197
|
+
- spec/models/rspeed/redis/get_spec.rb
|
198
|
+
- spec/models/rspeed/redis/keys_spec.rb
|
199
|
+
- spec/models/rspeed/redis/result_spec.rb
|
200
|
+
- spec/models/rspeed/redis/set_spec.rb
|
201
|
+
- spec/models/rspeed/redis/specs_finished_spec.rb
|
202
|
+
- spec/models/rspeed/redis/specs_initiated_spec.rb
|
203
|
+
- spec/models/rspeed/runner/run_spec.rb
|
123
204
|
- spec/models/rspeed/splitter/actual_examples_spec.rb
|
124
205
|
- spec/models/rspeed/splitter/append_spec.rb
|
125
|
-
- spec/models/rspeed/splitter/destroy_spec.rb
|
126
206
|
- spec/models/rspeed/splitter/diff_spec.rb
|
127
207
|
- spec/models/rspeed/splitter/first_pipe_spec.rb
|
128
208
|
- spec/models/rspeed/splitter/get_spec.rb
|
129
|
-
- spec/models/rspeed/splitter/
|
130
|
-
- spec/models/rspeed/splitter/
|
131
|
-
- spec/models/rspeed/splitter/pipe_spec.rb
|
132
|
-
- spec/models/rspeed/splitter/pipes_spec.rb
|
209
|
+
- spec/models/rspeed/splitter/pipe_files_spec.rb
|
210
|
+
- spec/models/rspeed/splitter/redundant_run_spec.rb
|
133
211
|
- spec/models/rspeed/splitter/rename_spec.rb
|
134
|
-
- spec/models/rspeed/splitter/result_spec.rb
|
135
|
-
- spec/models/rspeed/splitter/save_spec.rb
|
136
212
|
- spec/models/rspeed/splitter/split_spec.rb
|
137
|
-
- spec/
|
213
|
+
- spec/models/rspeed/variable/append_name_spec.rb
|
214
|
+
- spec/models/rspeed/variable/csv_spec.rb
|
215
|
+
- spec/models/rspeed/variable/default_partner_spec.rb
|
216
|
+
- spec/models/rspeed/variable/key_spec.rb
|
217
|
+
- spec/models/rspeed/variable/pipe_name_spec.rb
|
218
|
+
- spec/models/rspeed/variable/pipes_pattern_spec.rb
|
219
|
+
- spec/models/rspeed/variable/result_spec.rb
|
220
|
+
- spec/models/rspeed/variable/tmp_spec.rb
|
221
|
+
- spec/spec_helper.rb
|
222
|
+
- spec/support/common.rb
|
223
|
+
- spec/support/coverage.rb
|
224
|
+
- spec/support/env_mock.rb
|
225
|
+
- spec/support/fakeredis.rb
|
138
226
|
homepage: https://github.com/wbotelhos/rspeed
|
139
227
|
licenses:
|
140
228
|
- MIT
|
@@ -154,29 +242,58 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
242
|
- !ruby/object:Gem::Version
|
155
243
|
version: '0'
|
156
244
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
245
|
+
rubygems_version: 3.1.2
|
158
246
|
signing_key:
|
159
247
|
specification_version: 4
|
160
248
|
summary: Split and speed up your RSpec tests.
|
161
249
|
test_files:
|
250
|
+
- spec/spec_helper.rb
|
251
|
+
- spec/models/rspeed/variable/pipes_pattern_spec.rb
|
252
|
+
- spec/models/rspeed/variable/tmp_spec.rb
|
253
|
+
- spec/models/rspeed/variable/default_partner_spec.rb
|
254
|
+
- spec/models/rspeed/variable/csv_spec.rb
|
255
|
+
- spec/models/rspeed/variable/append_name_spec.rb
|
256
|
+
- spec/models/rspeed/variable/result_spec.rb
|
257
|
+
- spec/models/rspeed/variable/key_spec.rb
|
258
|
+
- spec/models/rspeed/variable/pipe_name_spec.rb
|
259
|
+
- spec/models/rspeed/redis/destroy_spec.rb
|
260
|
+
- spec/models/rspeed/redis/get_spec.rb
|
261
|
+
- spec/models/rspeed/redis/client_spec.rb
|
262
|
+
- spec/models/rspeed/redis/specs_finished_spec.rb
|
263
|
+
- spec/models/rspeed/redis/set_spec.rb
|
264
|
+
- spec/models/rspeed/redis/clean_pipes_flag_spec.rb
|
265
|
+
- spec/models/rspeed/redis/specs_initiated_spec.rb
|
266
|
+
- spec/models/rspeed/redis/result_spec.rb
|
267
|
+
- spec/models/rspeed/redis/keys_spec.rb
|
268
|
+
- spec/models/rspeed/runner/run_spec.rb
|
162
269
|
- spec/models/rspeed/splitter/append_spec.rb
|
163
|
-
- spec/models/rspeed/splitter/destroy_spec.rb
|
164
|
-
- spec/models/rspeed/splitter/pipe_spec.rb
|
165
270
|
- spec/models/rspeed/splitter/actual_examples_spec.rb
|
166
271
|
- spec/models/rspeed/splitter/get_spec.rb
|
167
272
|
- spec/models/rspeed/splitter/rename_spec.rb
|
168
|
-
- spec/models/rspeed/splitter/
|
273
|
+
- spec/models/rspeed/splitter/redundant_run_spec.rb
|
274
|
+
- spec/models/rspeed/splitter/pipe_files_spec.rb
|
169
275
|
- spec/models/rspeed/splitter/first_pipe_spec.rb
|
170
|
-
- spec/models/rspeed/splitter/result_spec.rb
|
171
|
-
- spec/models/rspeed/splitter/save_spec.rb
|
172
|
-
- spec/models/rspeed/splitter/keys_spec.rb
|
173
276
|
- spec/models/rspeed/splitter/diff_spec.rb
|
174
277
|
- spec/models/rspeed/splitter/split_spec.rb
|
175
|
-
- spec/models/rspeed/splitter/pipes_spec.rb
|
176
278
|
- spec/models/rspeed/observer/before_suite_spec.rb
|
177
279
|
- spec/models/rspeed/observer/before_spec.rb
|
280
|
+
- spec/models/rspeed/observer/after_suite_spec.rb
|
178
281
|
- spec/models/rspeed/observer/after_spec.rb
|
282
|
+
- spec/models/rspeed/env/pipe_spec.rb
|
283
|
+
- spec/models/rspeed/env/rspeed_spec.rb
|
284
|
+
- spec/models/rspeed/env/tmp_spec.rb
|
285
|
+
- spec/models/rspeed/env/port_spec.rb
|
286
|
+
- spec/models/rspeed/env/name_spec.rb
|
287
|
+
- spec/models/rspeed/env/host_spec.rb
|
288
|
+
- spec/models/rspeed/env/db_spec.rb
|
289
|
+
- spec/models/rspeed/env/result_key_spec.rb
|
290
|
+
- spec/models/rspeed/env/pipes_spec.rb
|
291
|
+
- spec/common_helper.rb
|
292
|
+
- spec/support/fakeredis.rb
|
293
|
+
- spec/support/env_mock.rb
|
294
|
+
- spec/support/common.rb
|
295
|
+
- spec/support/coverage.rb
|
179
296
|
- spec/fixtures/new_spec.rb.csv
|
180
297
|
- spec/fixtures/1_spec.rb
|
298
|
+
- spec/fixtures/empty.rb
|
181
299
|
- spec/fixtures/2_spec.rb
|
182
|
-
- spec/rails_helper.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe RSpeed::Splitter, '#destroy' do
|
6
|
-
subject(:splitter) { described_class.new }
|
7
|
-
|
8
|
-
let!(:redis) { redis_object }
|
9
|
-
|
10
|
-
before do
|
11
|
-
redis.set 'rspeed', '{}'
|
12
|
-
redis.set 'rspeed_1', '{}'
|
13
|
-
redis.set 'rspeed_2', '{}'
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'destroys via wildcard' do
|
17
|
-
splitter.destroy 'rspeed_*'
|
18
|
-
|
19
|
-
expect(splitter.keys('*')).to eq %w[rspeed]
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'destroys via single name' do
|
23
|
-
splitter.destroy 'rspeed'
|
24
|
-
|
25
|
-
expect(splitter.keys('*')).to eq %w[rspeed_1 rspeed_2]
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'destroys default partner when no pattern is given' do
|
29
|
-
splitter.destroy
|
30
|
-
|
31
|
-
expect(splitter.keys('*')).to eq %w[rspeed]
|
32
|
-
end
|
33
|
-
end
|