copy_tuner_client 0.5.1 → 0.5.2
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
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +51 -1
- data/Rakefile +5 -5
- data/lib/copy_tuner_client/cache.rb +13 -13
- data/lib/copy_tuner_client/version.rb +1 -1
- data/spec/copy_tuner_client/cache_spec.rb +43 -35
- data/spec/copy_tuner_client/client_spec.rb +3 -1
- data/spec/copy_tuner_client/copyray_spec.rb +2 -0
- data/spec/copy_tuner_client/i18n_backend_spec.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c72f170af0093637a763c2e02771cfd584d2c522
|
|
4
|
+
data.tar.gz: c4ef0334c658f6c16798467505f7dc73ce0447ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04645e2ca212fba15311d766e203770e915aeadd19b44d47ddf1828928c94d5a5d4eed5ebf50c40ed1c0590774ff521154ff4b2f55e2e22dd3ea825208ea750a
|
|
7
|
+
data.tar.gz: 8fc97dc1dea41024746490e8bd6e07edd6ec876ee89c79d732c5aa74fa5a99ec0c2c25d011487a9cf10aec1830a91dc5b0c9624c2744c37f039189dc67eed3f8
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: git://github.com/SonicGarden/sgcop.git
|
|
3
|
+
revision: 7ba086cff0068d231f55f5be788b757383d3ccba
|
|
4
|
+
specs:
|
|
5
|
+
sgcop (0.0.29)
|
|
6
|
+
brakeman
|
|
7
|
+
brakeman_translate_checkstyle_format
|
|
8
|
+
haml_lint (~> 0.32.0)
|
|
9
|
+
rubocop (~> 0.71.0)
|
|
10
|
+
rubocop-performance (~> 1.4.0)
|
|
11
|
+
rubocop-rails (~> 2.0.1)
|
|
12
|
+
rubocop-rspec (~> 1.33.0)
|
|
13
|
+
|
|
1
14
|
PATH
|
|
2
15
|
remote: .
|
|
3
16
|
specs:
|
|
4
|
-
copy_tuner_client (0.5.
|
|
17
|
+
copy_tuner_client (0.5.2)
|
|
5
18
|
i18n (>= 0.5.0)
|
|
6
19
|
json
|
|
7
20
|
|
|
@@ -53,6 +66,10 @@ GEM
|
|
|
53
66
|
childprocess (>= 0.3.6)
|
|
54
67
|
cucumber (>= 1.1.1)
|
|
55
68
|
rspec-expectations (>= 2.7.0)
|
|
69
|
+
ast (2.4.0)
|
|
70
|
+
brakeman (4.5.1)
|
|
71
|
+
brakeman_translate_checkstyle_format (0.0.1)
|
|
72
|
+
thor
|
|
56
73
|
builder (3.2.3)
|
|
57
74
|
childprocess (0.6.3)
|
|
58
75
|
ffi (~> 1.0, >= 1.0.11)
|
|
@@ -74,8 +91,18 @@ GEM
|
|
|
74
91
|
multi_json (~> 1.3)
|
|
75
92
|
globalid (0.3.7)
|
|
76
93
|
activesupport (>= 4.1.0)
|
|
94
|
+
haml (5.1.1)
|
|
95
|
+
temple (>= 0.8.0)
|
|
96
|
+
tilt
|
|
97
|
+
haml_lint (0.32.0)
|
|
98
|
+
haml (>= 4.0, < 5.2)
|
|
99
|
+
rainbow
|
|
100
|
+
rake (>= 10, < 13)
|
|
101
|
+
rubocop (>= 0.50.0)
|
|
102
|
+
sysexits (~> 1.1)
|
|
77
103
|
hashdiff (0.3.2)
|
|
78
104
|
i18n (0.8.1)
|
|
105
|
+
jaro_winkler (1.5.3)
|
|
79
106
|
json (2.2.0)
|
|
80
107
|
loofah (2.0.3)
|
|
81
108
|
nokogiri (>= 1.5.9)
|
|
@@ -90,6 +117,9 @@ GEM
|
|
|
90
117
|
multi_test (0.1.2)
|
|
91
118
|
nokogiri (1.8.2)
|
|
92
119
|
mini_portile2 (~> 2.3.0)
|
|
120
|
+
parallel (1.17.0)
|
|
121
|
+
parser (2.6.3.0)
|
|
122
|
+
ast (~> 2.4.0)
|
|
93
123
|
public_suffix (2.0.5)
|
|
94
124
|
rack (1.6.5)
|
|
95
125
|
rack-protection (1.5.3)
|
|
@@ -120,6 +150,7 @@ GEM
|
|
|
120
150
|
activesupport (= 4.2.8)
|
|
121
151
|
rake (>= 0.8.7)
|
|
122
152
|
thor (>= 0.18.1, < 2.0)
|
|
153
|
+
rainbow (3.0.0)
|
|
123
154
|
rake (12.0.0)
|
|
124
155
|
rspec (3.5.0)
|
|
125
156
|
rspec-core (~> 3.5.0)
|
|
@@ -134,6 +165,21 @@ GEM
|
|
|
134
165
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
135
166
|
rspec-support (~> 3.5.0)
|
|
136
167
|
rspec-support (3.5.0)
|
|
168
|
+
rubocop (0.71.0)
|
|
169
|
+
jaro_winkler (~> 1.5.1)
|
|
170
|
+
parallel (~> 1.10)
|
|
171
|
+
parser (>= 2.6)
|
|
172
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
173
|
+
ruby-progressbar (~> 1.7)
|
|
174
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
|
175
|
+
rubocop-performance (1.4.0)
|
|
176
|
+
rubocop (>= 0.71.0)
|
|
177
|
+
rubocop-rails (2.0.1)
|
|
178
|
+
rack (>= 1.1)
|
|
179
|
+
rubocop (>= 0.70.0)
|
|
180
|
+
rubocop-rspec (1.33.0)
|
|
181
|
+
rubocop (>= 0.60.0)
|
|
182
|
+
ruby-progressbar (1.10.1)
|
|
137
183
|
safe_yaml (1.0.4)
|
|
138
184
|
sham_rack (1.4.0)
|
|
139
185
|
rack
|
|
@@ -149,6 +195,8 @@ GEM
|
|
|
149
195
|
activesupport (>= 4.0)
|
|
150
196
|
sprockets (>= 3.0.0)
|
|
151
197
|
sqlite3 (1.3.13)
|
|
198
|
+
sysexits (1.2.0)
|
|
199
|
+
temple (0.8.1)
|
|
152
200
|
thin (1.7.0)
|
|
153
201
|
daemons (~> 1.0, >= 1.0.9)
|
|
154
202
|
eventmachine (~> 1.0, >= 1.0.4)
|
|
@@ -158,6 +206,7 @@ GEM
|
|
|
158
206
|
tilt (2.0.7)
|
|
159
207
|
tzinfo (1.2.3)
|
|
160
208
|
thread_safe (~> 0.1)
|
|
209
|
+
unicode-display_width (1.6.0)
|
|
161
210
|
webmock (2.3.2)
|
|
162
211
|
addressable (>= 2.3.6)
|
|
163
212
|
crack (>= 0.3.2)
|
|
@@ -175,6 +224,7 @@ DEPENDENCIES
|
|
|
175
224
|
rails (~> 4.2.6)
|
|
176
225
|
rake
|
|
177
226
|
rspec
|
|
227
|
+
sgcop!
|
|
178
228
|
sham_rack
|
|
179
229
|
sinatra
|
|
180
230
|
sqlite3
|
data/Rakefile
CHANGED
|
@@ -4,16 +4,16 @@ require 'cucumber/rake/task'
|
|
|
4
4
|
require 'rspec/core/rake_task'
|
|
5
5
|
require 'yard'
|
|
6
6
|
|
|
7
|
-
desc 'Default: run the specs
|
|
8
|
-
task :
|
|
7
|
+
desc 'Default: run the specs.'
|
|
8
|
+
task default: [:spec]
|
|
9
9
|
|
|
10
10
|
desc 'Test the copy_tuner_client plugin.'
|
|
11
11
|
RSpec::Core::RakeTask.new do |t|
|
|
12
|
-
t.rspec_opts = ['--color',
|
|
12
|
+
t.rspec_opts = ['--color', '--format progress']
|
|
13
13
|
t.pattern = 'spec/copy_tuner_client/**/*_spec.rb'
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
desc
|
|
16
|
+
desc 'Run cucumber features'
|
|
17
17
|
Cucumber::Rake::Task.new do |t|
|
|
18
18
|
t.cucumber_opts = [
|
|
19
19
|
'--tags', '~@wip',
|
|
@@ -22,5 +22,5 @@ Cucumber::Rake::Task.new do |t|
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
YARD::Rake::YardocTask.new do |t|
|
|
25
|
-
t.files
|
|
25
|
+
t.files = ['lib/**/*.rb']
|
|
26
26
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'thread'
|
|
2
1
|
require 'copy_tuner_client/client'
|
|
3
2
|
require 'copy_tuner_client/dotted_hash'
|
|
4
3
|
|
|
@@ -40,9 +39,12 @@ module CopyTunerClient
|
|
|
40
39
|
# @param value [String] the new contents of the blurb
|
|
41
40
|
def []=(key, value)
|
|
42
41
|
return if @exclude_key_regexp && key.match?(@exclude_key_regexp)
|
|
42
|
+
return unless key.include?('.')
|
|
43
43
|
return if @locales.present? && !@locales.member?(key.split('.').first)
|
|
44
|
+
|
|
44
45
|
lock do
|
|
45
46
|
return if @blank_keys.member?(key) || @blurbs.key?(key)
|
|
47
|
+
|
|
46
48
|
@queued[key] = value
|
|
47
49
|
end
|
|
48
50
|
end
|
|
@@ -61,17 +63,15 @@ module CopyTunerClient
|
|
|
61
63
|
|
|
62
64
|
# Waits until the first download has finished.
|
|
63
65
|
def wait_for_download
|
|
64
|
-
|
|
65
|
-
logger.info 'Waiting for first download'
|
|
66
|
+
return unless pending?
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
logger.flush
|
|
69
|
-
end
|
|
68
|
+
logger.info 'Waiting for first download'
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
end
|
|
70
|
+
if logger.respond_to? :flush
|
|
71
|
+
logger.flush
|
|
74
72
|
end
|
|
73
|
+
|
|
74
|
+
sleep 0.1 while pending?
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def flush
|
|
@@ -82,8 +82,8 @@ module CopyTunerClient
|
|
|
82
82
|
@last_uploaded_at = Time.now.utc
|
|
83
83
|
|
|
84
84
|
res
|
|
85
|
-
rescue ConnectionError =>
|
|
86
|
-
logger.error
|
|
85
|
+
rescue ConnectionError => e
|
|
86
|
+
logger.error e.message
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def download
|
|
@@ -100,8 +100,8 @@ module CopyTunerClient
|
|
|
100
100
|
@last_downloaded_at = Time.now.utc
|
|
101
101
|
|
|
102
102
|
res
|
|
103
|
-
rescue ConnectionError =>
|
|
104
|
-
logger.error
|
|
103
|
+
rescue ConnectionError => e
|
|
104
|
+
logger.error e.message
|
|
105
105
|
ensure
|
|
106
106
|
@downloaded = true
|
|
107
107
|
end
|
|
@@ -9,7 +9,7 @@ describe CopyTunerClient::Cache do
|
|
|
9
9
|
CopyTunerClient::Cache.new(client, default_config.update(config))
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
it
|
|
12
|
+
it 'provides access to downloaded data' do
|
|
13
13
|
client['en.test.key'] = 'expected'
|
|
14
14
|
client['en.test.other_key'] = 'expected'
|
|
15
15
|
|
|
@@ -18,17 +18,17 @@ describe CopyTunerClient::Cache do
|
|
|
18
18
|
cache.download
|
|
19
19
|
|
|
20
20
|
expect(cache['en.test.key']).to eq('expected')
|
|
21
|
-
expect(cache.keys).to match_array(%w
|
|
21
|
+
expect(cache.keys).to match_array(%w[en.test.key en.test.other_key])
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
it
|
|
24
|
+
it 'exclude data if exclude_key_regexp is set' do
|
|
25
25
|
cache = build_cache(exclude_key_regexp: /^en\.test\.other_key$/)
|
|
26
26
|
cache['en.test.key'] = 'expected'
|
|
27
27
|
cache['en.test.other_key'] = 'expected'
|
|
28
28
|
|
|
29
29
|
cache.download
|
|
30
30
|
|
|
31
|
-
expect(cache.queued.keys).to match_array(%w
|
|
31
|
+
expect(cache.queued.keys).to match_array(%w[en.test.key])
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "doesn't upload without changes" do
|
|
@@ -37,7 +37,15 @@ describe CopyTunerClient::Cache do
|
|
|
37
37
|
expect(client).not_to be_uploaded
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
it "
|
|
40
|
+
it "Don't upload incorrect key" do
|
|
41
|
+
cache = build_cache
|
|
42
|
+
cache['ja'] = 'incorrect key'
|
|
43
|
+
|
|
44
|
+
cache.flush
|
|
45
|
+
expect(client).not_to be_uploaded
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'uploads changes when flushed' do
|
|
41
49
|
cache = build_cache
|
|
42
50
|
cache['test.key'] = 'test value'
|
|
43
51
|
|
|
@@ -46,7 +54,7 @@ describe CopyTunerClient::Cache do
|
|
|
46
54
|
expect(client.uploaded).to eq({ 'test.key' => 'test value' })
|
|
47
55
|
end
|
|
48
56
|
|
|
49
|
-
it
|
|
57
|
+
it 'uploads empties when nil is assigned' do
|
|
50
58
|
cache = build_cache
|
|
51
59
|
cache['test.key'] = nil
|
|
52
60
|
|
|
@@ -62,7 +70,7 @@ describe CopyTunerClient::Cache do
|
|
|
62
70
|
|
|
63
71
|
cache.flush
|
|
64
72
|
|
|
65
|
-
expect(client.uploaded).to eq({'en.test.key' => 'uploaded en', 'ja.test.key' => 'uploaded ja'})
|
|
73
|
+
expect(client.uploaded).to eq({ 'en.test.key' => 'uploaded en', 'ja.test.key' => 'uploaded ja' })
|
|
66
74
|
end
|
|
67
75
|
|
|
68
76
|
it 'upload with locale filter' do
|
|
@@ -72,10 +80,10 @@ describe CopyTunerClient::Cache do
|
|
|
72
80
|
|
|
73
81
|
cache.flush
|
|
74
82
|
|
|
75
|
-
expect(client.uploaded).to eq({'en.test.key' => 'uploaded'})
|
|
83
|
+
expect(client.uploaded).to eq({ 'en.test.key' => 'uploaded' })
|
|
76
84
|
end
|
|
77
85
|
|
|
78
|
-
it
|
|
86
|
+
it 'downloads changes' do
|
|
79
87
|
client['test.key'] = 'test value'
|
|
80
88
|
cache = build_cache
|
|
81
89
|
|
|
@@ -84,7 +92,7 @@ describe CopyTunerClient::Cache do
|
|
|
84
92
|
expect(cache['test.key']).to eq('test value')
|
|
85
93
|
end
|
|
86
94
|
|
|
87
|
-
it
|
|
95
|
+
it 'downloads and uploads when synced' do
|
|
88
96
|
cache = build_cache
|
|
89
97
|
client['test.key'] = 'test value'
|
|
90
98
|
cache['other.key'] = 'other value'
|
|
@@ -95,7 +103,7 @@ describe CopyTunerClient::Cache do
|
|
|
95
103
|
expect(cache['test.key']).to eq('test value')
|
|
96
104
|
end
|
|
97
105
|
|
|
98
|
-
it
|
|
106
|
+
it 'download included empty keys' do
|
|
99
107
|
client['en.test.key'] = 'test value'
|
|
100
108
|
client['en.test.empty'] = ''
|
|
101
109
|
cache = build_cache
|
|
@@ -109,7 +117,7 @@ describe CopyTunerClient::Cache do
|
|
|
109
117
|
expect(cache.queued).to be_empty
|
|
110
118
|
end
|
|
111
119
|
|
|
112
|
-
it
|
|
120
|
+
it 'Do not upload downloaded keys' do
|
|
113
121
|
client['en.test.key'] = 'test value'
|
|
114
122
|
cache = build_cache
|
|
115
123
|
|
|
@@ -119,11 +127,11 @@ describe CopyTunerClient::Cache do
|
|
|
119
127
|
expect(cache.queued).to be_empty
|
|
120
128
|
end
|
|
121
129
|
|
|
122
|
-
it
|
|
123
|
-
failure =
|
|
130
|
+
it 'handles connection errors when flushing' do
|
|
131
|
+
failure = 'server is napping'
|
|
124
132
|
logger = FakeLogger.new
|
|
125
133
|
expect(client).to receive(:upload).and_raise(CopyTunerClient::ConnectionError.new(failure))
|
|
126
|
-
cache = build_cache(:
|
|
134
|
+
cache = build_cache(logger: logger)
|
|
127
135
|
cache['upload.key'] = 'upload'
|
|
128
136
|
|
|
129
137
|
cache.flush
|
|
@@ -131,22 +139,22 @@ describe CopyTunerClient::Cache do
|
|
|
131
139
|
expect(logger).to have_entry(:error, failure)
|
|
132
140
|
end
|
|
133
141
|
|
|
134
|
-
it
|
|
135
|
-
failure =
|
|
142
|
+
it 'handles connection errors when downloading' do
|
|
143
|
+
failure = 'server is napping'
|
|
136
144
|
logger = FakeLogger.new
|
|
137
145
|
expect(client).to receive(:download).and_raise(CopyTunerClient::ConnectionError.new(failure))
|
|
138
|
-
cache = build_cache(:
|
|
146
|
+
cache = build_cache(logger: logger)
|
|
139
147
|
|
|
140
148
|
cache.download
|
|
141
149
|
|
|
142
150
|
expect(logger).to have_entry(:error, failure)
|
|
143
151
|
end
|
|
144
152
|
|
|
145
|
-
it
|
|
153
|
+
it 'blocks until the first download is complete' do
|
|
146
154
|
logger = FakeLogger.new
|
|
147
155
|
expect(logger).to receive(:flush)
|
|
148
156
|
client.delay = true
|
|
149
|
-
cache = build_cache(:
|
|
157
|
+
cache = build_cache(logger: logger)
|
|
150
158
|
|
|
151
159
|
t_download = Thread.new { cache.download }
|
|
152
160
|
sleep 0.1 until cache.pending?
|
|
@@ -154,7 +162,7 @@ describe CopyTunerClient::Cache do
|
|
|
154
162
|
t_wait = Thread.new do
|
|
155
163
|
cache.wait_for_download
|
|
156
164
|
end
|
|
157
|
-
sleep 0.1 until logger.has_entry?(:info,
|
|
165
|
+
sleep 0.1 until logger.has_entry?(:info, 'Waiting for first download')
|
|
158
166
|
client.go
|
|
159
167
|
expect(t_download.join(1)).not_to be_nil
|
|
160
168
|
expect(cache.pending?).to be_falsey
|
|
@@ -163,7 +171,7 @@ describe CopyTunerClient::Cache do
|
|
|
163
171
|
|
|
164
172
|
it "doesn't block if the first download fails" do
|
|
165
173
|
client.delay = true
|
|
166
|
-
client.error = StandardError.new(
|
|
174
|
+
client.error = StandardError.new('Failure')
|
|
167
175
|
cache = build_cache
|
|
168
176
|
|
|
169
177
|
error = nil
|
|
@@ -183,12 +191,12 @@ describe CopyTunerClient::Cache do
|
|
|
183
191
|
expect(t_download.join(1)).not_to be_nil
|
|
184
192
|
expect(error).to be_kind_of(StandardError)
|
|
185
193
|
expect(t_wait.join(1)).not_to be_nil
|
|
186
|
-
expect { cache.download }.to raise_error(StandardError,
|
|
194
|
+
expect { cache.download }.to raise_error(StandardError, 'Failure')
|
|
187
195
|
end
|
|
188
196
|
|
|
189
197
|
it "doesn't block before downloading" do
|
|
190
198
|
logger = FakeLogger.new
|
|
191
|
-
cache = build_cache(:
|
|
199
|
+
cache = build_cache(logger: logger)
|
|
192
200
|
|
|
193
201
|
finished = false
|
|
194
202
|
Thread.new do
|
|
@@ -199,7 +207,7 @@ describe CopyTunerClient::Cache do
|
|
|
199
207
|
sleep(1)
|
|
200
208
|
|
|
201
209
|
expect(finished).to eq(true)
|
|
202
|
-
expect(logger).not_to have_entry(:info,
|
|
210
|
+
expect(logger).not_to have_entry(:info, 'Waiting for first download')
|
|
203
211
|
end
|
|
204
212
|
|
|
205
213
|
it "doesn't return blank copy" do
|
|
@@ -211,13 +219,13 @@ describe CopyTunerClient::Cache do
|
|
|
211
219
|
expect(cache['en.test.key']).to be_nil
|
|
212
220
|
end
|
|
213
221
|
|
|
214
|
-
describe
|
|
222
|
+
describe 'given locked mutex' do
|
|
215
223
|
RSpec::Matchers.define :finish_after_unlocking do |mutex|
|
|
216
224
|
match do |thread|
|
|
217
225
|
sleep(0.1)
|
|
218
226
|
|
|
219
227
|
if thread.status === false
|
|
220
|
-
violated(
|
|
228
|
+
violated('finished before unlocking')
|
|
221
229
|
else
|
|
222
230
|
mutex.unlock
|
|
223
231
|
sleep(0.1)
|
|
@@ -225,7 +233,7 @@ describe CopyTunerClient::Cache do
|
|
|
225
233
|
if thread.status === false
|
|
226
234
|
true
|
|
227
235
|
else
|
|
228
|
-
violated(
|
|
236
|
+
violated('still running after unlocking')
|
|
229
237
|
end
|
|
230
238
|
end
|
|
231
239
|
end
|
|
@@ -248,20 +256,20 @@ describe CopyTunerClient::Cache do
|
|
|
248
256
|
allow(Mutex).to receive(:new).and_return(mutex)
|
|
249
257
|
end
|
|
250
258
|
|
|
251
|
-
it
|
|
259
|
+
it 'synchronizes read access to keys between threads' do
|
|
252
260
|
expect(Thread.new { cache['test.key'] }).to finish_after_unlocking(mutex)
|
|
253
261
|
end
|
|
254
262
|
|
|
255
|
-
it
|
|
263
|
+
it 'synchronizes read access to the key list between threads' do
|
|
256
264
|
expect(Thread.new { cache.keys }).to finish_after_unlocking(mutex)
|
|
257
265
|
end
|
|
258
266
|
|
|
259
|
-
it
|
|
267
|
+
it 'synchronizes write access to keys between threads' do
|
|
260
268
|
expect(Thread.new { cache['test.key'] = 'value' }).to finish_after_unlocking(mutex)
|
|
261
269
|
end
|
|
262
270
|
end
|
|
263
271
|
|
|
264
|
-
it
|
|
272
|
+
it 'flushes from the top level' do
|
|
265
273
|
cache = build_cache
|
|
266
274
|
CopyTunerClient.configure do |config|
|
|
267
275
|
config.cache = cache
|
|
@@ -271,7 +279,7 @@ describe CopyTunerClient::Cache do
|
|
|
271
279
|
CopyTunerClient.flush
|
|
272
280
|
end
|
|
273
281
|
|
|
274
|
-
describe
|
|
282
|
+
describe '#export' do
|
|
275
283
|
subject { cache.export }
|
|
276
284
|
|
|
277
285
|
let(:cache) do
|
|
@@ -280,7 +288,7 @@ describe CopyTunerClient::Cache do
|
|
|
280
288
|
cache
|
|
281
289
|
end
|
|
282
290
|
|
|
283
|
-
it
|
|
291
|
+
it 'can be invoked from the top-level constant' do
|
|
284
292
|
CopyTunerClient.configure do |config|
|
|
285
293
|
config.cache = cache
|
|
286
294
|
end
|
|
@@ -292,7 +300,7 @@ describe CopyTunerClient::Cache do
|
|
|
292
300
|
is_expected.to eq nil
|
|
293
301
|
end
|
|
294
302
|
|
|
295
|
-
context
|
|
303
|
+
context 'with single-level blurb keys' do
|
|
296
304
|
before do
|
|
297
305
|
client['key'] = 'test value'
|
|
298
306
|
client['other_key'] = 'other test value'
|
|
@@ -5,7 +5,8 @@ describe CopyTunerClient do
|
|
|
5
5
|
config[:logger] ||= FakeLogger.new
|
|
6
6
|
default_config = CopyTunerClient::Configuration.new.to_hash
|
|
7
7
|
default_config[:s3_host] = 'copy-tuner.com'
|
|
8
|
-
CopyTunerClient::Client.new(default_config.update(config))
|
|
8
|
+
client = CopyTunerClient::Client.new(default_config.update(config))
|
|
9
|
+
client
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def add_project
|
|
@@ -197,6 +198,7 @@ describe CopyTunerClient do
|
|
|
197
198
|
|
|
198
199
|
it "deploys from the top-level constant" do
|
|
199
200
|
client = build_client
|
|
201
|
+
allow(client).to receive(:download)
|
|
200
202
|
CopyTunerClient.configure do |config|
|
|
201
203
|
config.client = client
|
|
202
204
|
end
|
|
@@ -16,6 +16,7 @@ describe CopyTunerClient::Copyray do
|
|
|
16
16
|
before do
|
|
17
17
|
CopyTunerClient.configure do |configuration|
|
|
18
18
|
configuration.html_escape = false
|
|
19
|
+
configuration.client = FakeClient.new
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -36,6 +37,7 @@ describe CopyTunerClient::Copyray do
|
|
|
36
37
|
before do
|
|
37
38
|
CopyTunerClient.configure do |configuration|
|
|
38
39
|
configuration.html_escape = true
|
|
40
|
+
configuration.client = FakeClient.new
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: copy_tuner_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SonicGarden
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|
|
@@ -216,6 +216,7 @@ files:
|
|
|
216
216
|
- ".eslintrc"
|
|
217
217
|
- ".gitignore"
|
|
218
218
|
- ".rspec"
|
|
219
|
+
- ".rubocop.yml"
|
|
219
220
|
- ".ruby-version"
|
|
220
221
|
- ".travis.yml"
|
|
221
222
|
- Appraisals
|