copy_tuner_client 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +8 -2
- data/Appraisals +2 -2
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +82 -78
- data/README.md +30 -9
- data/copy_tuner_client.gemspec +1 -1
- data/features/step_definitions/copycopter_server_steps.rb +1 -1
- data/features/step_definitions/rails_steps.rb +4 -4
- data/gemfiles/4.1.gemfile +1 -1
- data/gemfiles/4.2.gemfile +1 -1
- data/lib/copy_tuner_client/engine.rb +2 -1
- data/lib/copy_tuner_client/simple_form_extention.rb +2 -1
- data/lib/copy_tuner_client/translation_log.rb +2 -1
- data/lib/copy_tuner_client/version.rb +1 -1
- data/spec/copy_tuner_client/cache_spec.rb +27 -27
- data/spec/copy_tuner_client/client_spec.rb +20 -20
- data/spec/copy_tuner_client/configuration_spec.rb +63 -63
- data/spec/copy_tuner_client/i18n_backend_spec.rb +32 -32
- data/spec/copy_tuner_client/poller_spec.rb +8 -8
- data/spec/copy_tuner_client/prefixed_logger_spec.rb +5 -5
- data/spec/copy_tuner_client/process_guard_spec.rb +10 -10
- data/spec/copy_tuner_client/request_sync_spec.rb +12 -12
- data/spec/copy_tuner_client_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fake_copy_tuner_app.rb +1 -0
- data/spec/support/fake_logger.rb +2 -2
- metadata +7 -9
- data/tmp/projects.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07fe56c9db1edad412f1af3596b85021fc96d485
|
4
|
+
data.tar.gz: d8cff9d0621acebe92f9179102106cbb1b7ab371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c675b1660904b2961660c6f1e18387cc15f663289b3d4cadd3f4a00104c25dd6927a3ecfb11410ebe8bd922a5e08c4dac166a26791363e895c354358014aba6f
|
7
|
+
data.tar.gz: 9eb3a9e05e2b3919c0c8fc86bd65f0b5e75f30515b95388e8f3f296d8a4503ec10cd4ea2c5d7824464db6441819e6e5f4e583828c5b7733c017ec8f4b5acd097
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.3
|
data/.travis.yml
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
rvm:
|
2
|
-
- 2.0
|
3
|
-
- 2.1
|
4
2
|
- 2.2
|
5
3
|
- 2.3
|
4
|
+
- 2.4.1
|
6
5
|
|
7
6
|
gemfile:
|
8
7
|
- gemfiles/4.0.gemfile
|
9
8
|
- gemfiles/4.1.gemfile
|
10
9
|
- gemfiles/4.2.gemfile
|
11
10
|
|
11
|
+
matrix:
|
12
|
+
exclude:
|
13
|
+
- rvm: 2.4.1
|
14
|
+
gemfile: gemfiles/4.0.gemfile
|
15
|
+
- rvm: 2.4.1
|
16
|
+
gemfile: gemfiles/4.1.gemfile
|
17
|
+
|
12
18
|
before_install:
|
13
19
|
- gem update bundler
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,64 +1,64 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
copy_tuner_client (0.3.
|
4
|
+
copy_tuner_client (0.3.5)
|
5
5
|
i18n (>= 0.5.0)
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionmailer (4.2.
|
12
|
-
actionpack (= 4.2.
|
13
|
-
actionview (= 4.2.
|
14
|
-
activejob (= 4.2.
|
11
|
+
actionmailer (4.2.8)
|
12
|
+
actionpack (= 4.2.8)
|
13
|
+
actionview (= 4.2.8)
|
14
|
+
activejob (= 4.2.8)
|
15
15
|
mail (~> 2.5, >= 2.5.4)
|
16
16
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
-
actionpack (4.2.
|
18
|
-
actionview (= 4.2.
|
19
|
-
activesupport (= 4.2.
|
17
|
+
actionpack (4.2.8)
|
18
|
+
actionview (= 4.2.8)
|
19
|
+
activesupport (= 4.2.8)
|
20
20
|
rack (~> 1.6)
|
21
21
|
rack-test (~> 0.6.2)
|
22
22
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
23
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
-
actionview (4.2.
|
25
|
-
activesupport (= 4.2.
|
24
|
+
actionview (4.2.8)
|
25
|
+
activesupport (= 4.2.8)
|
26
26
|
builder (~> 3.1)
|
27
27
|
erubis (~> 2.7.0)
|
28
28
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
30
|
-
activejob (4.2.
|
31
|
-
activesupport (= 4.2.
|
29
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
30
|
+
activejob (4.2.8)
|
31
|
+
activesupport (= 4.2.8)
|
32
32
|
globalid (>= 0.3.0)
|
33
|
-
activemodel (4.2.
|
34
|
-
activesupport (= 4.2.
|
33
|
+
activemodel (4.2.8)
|
34
|
+
activesupport (= 4.2.8)
|
35
35
|
builder (~> 3.1)
|
36
|
-
activerecord (4.2.
|
37
|
-
activemodel (= 4.2.
|
38
|
-
activesupport (= 4.2.
|
36
|
+
activerecord (4.2.8)
|
37
|
+
activemodel (= 4.2.8)
|
38
|
+
activesupport (= 4.2.8)
|
39
39
|
arel (~> 6.0)
|
40
|
-
activesupport (4.2.
|
40
|
+
activesupport (4.2.8)
|
41
41
|
i18n (~> 0.7)
|
42
|
-
json (~> 1.7, >= 1.7.7)
|
43
42
|
minitest (~> 5.1)
|
44
43
|
thread_safe (~> 0.3, >= 0.3.4)
|
45
44
|
tzinfo (~> 1.1)
|
46
|
-
addressable (2.
|
45
|
+
addressable (2.5.1)
|
46
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
47
47
|
appraisal (2.1.0)
|
48
48
|
bundler
|
49
49
|
rake
|
50
50
|
thor (>= 0.14.0)
|
51
|
-
arel (6.0.
|
51
|
+
arel (6.0.4)
|
52
52
|
aruba (0.6.2)
|
53
53
|
childprocess (>= 0.3.6)
|
54
54
|
cucumber (>= 1.1.1)
|
55
55
|
rspec-expectations (>= 2.7.0)
|
56
56
|
bourne (1.6.0)
|
57
57
|
mocha (~> 1.1)
|
58
|
-
builder (3.2.
|
59
|
-
childprocess (0.
|
58
|
+
builder (3.2.3)
|
59
|
+
childprocess (0.6.3)
|
60
60
|
ffi (~> 1.0, >= 1.0.11)
|
61
|
-
concurrent-ruby (1.0.
|
61
|
+
concurrent-ruby (1.0.5)
|
62
62
|
crack (0.4.3)
|
63
63
|
safe_yaml (~> 1.0.0)
|
64
64
|
cucumber (1.3.20)
|
@@ -67,18 +67,18 @@ GEM
|
|
67
67
|
gherkin (~> 2.12)
|
68
68
|
multi_json (>= 1.7.5, < 2.0)
|
69
69
|
multi_test (>= 0.1.2)
|
70
|
-
daemons (1.2.
|
71
|
-
diff-lcs (1.
|
70
|
+
daemons (1.2.4)
|
71
|
+
diff-lcs (1.3)
|
72
72
|
erubis (2.7.0)
|
73
|
-
eventmachine (1.2.
|
74
|
-
ffi (1.9.
|
73
|
+
eventmachine (1.2.3)
|
74
|
+
ffi (1.9.18)
|
75
75
|
gherkin (2.12.2)
|
76
76
|
multi_json (~> 1.3)
|
77
|
-
globalid (0.3.
|
77
|
+
globalid (0.3.7)
|
78
78
|
activesupport (>= 4.1.0)
|
79
|
-
hashdiff (0.3.
|
80
|
-
i18n (0.
|
81
|
-
json (
|
79
|
+
hashdiff (0.3.2)
|
80
|
+
i18n (0.8.1)
|
81
|
+
json (2.0.4)
|
82
82
|
loofah (2.0.3)
|
83
83
|
nokogiri (>= 1.5.9)
|
84
84
|
mail (2.6.4)
|
@@ -88,82 +88,86 @@ GEM
|
|
88
88
|
mime-types-data (~> 3.2015)
|
89
89
|
mime-types-data (3.2016.0521)
|
90
90
|
mini_portile2 (2.1.0)
|
91
|
-
minitest (5.
|
92
|
-
mocha (1.1
|
91
|
+
minitest (5.10.1)
|
92
|
+
mocha (1.2.1)
|
93
93
|
metaclass (~> 0.0.1)
|
94
94
|
multi_json (1.12.1)
|
95
95
|
multi_test (0.1.2)
|
96
|
-
nokogiri (1.
|
96
|
+
nokogiri (1.7.1)
|
97
97
|
mini_portile2 (~> 2.1.0)
|
98
|
-
|
99
|
-
|
100
|
-
rack (1.6.4)
|
98
|
+
public_suffix (2.0.5)
|
99
|
+
rack (1.6.5)
|
101
100
|
rack-protection (1.5.3)
|
102
101
|
rack
|
103
102
|
rack-test (0.6.3)
|
104
103
|
rack (>= 1.0)
|
105
|
-
rails (4.2.
|
106
|
-
actionmailer (= 4.2.
|
107
|
-
actionpack (= 4.2.
|
108
|
-
actionview (= 4.2.
|
109
|
-
activejob (= 4.2.
|
110
|
-
activemodel (= 4.2.
|
111
|
-
activerecord (= 4.2.
|
112
|
-
activesupport (= 4.2.
|
104
|
+
rails (4.2.8)
|
105
|
+
actionmailer (= 4.2.8)
|
106
|
+
actionpack (= 4.2.8)
|
107
|
+
actionview (= 4.2.8)
|
108
|
+
activejob (= 4.2.8)
|
109
|
+
activemodel (= 4.2.8)
|
110
|
+
activerecord (= 4.2.8)
|
111
|
+
activesupport (= 4.2.8)
|
113
112
|
bundler (>= 1.3.0, < 2.0)
|
114
|
-
railties (= 4.2.
|
113
|
+
railties (= 4.2.8)
|
115
114
|
sprockets-rails
|
116
115
|
rails-deprecated_sanitizer (1.0.3)
|
117
116
|
activesupport (>= 4.2.0.alpha)
|
118
|
-
rails-dom-testing (1.0.
|
117
|
+
rails-dom-testing (1.0.8)
|
119
118
|
activesupport (>= 4.2.0.beta, < 5.0)
|
120
|
-
nokogiri (~> 1.6
|
119
|
+
nokogiri (~> 1.6)
|
121
120
|
rails-deprecated_sanitizer (>= 1.0.1)
|
122
121
|
rails-html-sanitizer (1.0.3)
|
123
122
|
loofah (~> 2.0)
|
124
|
-
railties (4.2.
|
125
|
-
actionpack (= 4.2.
|
126
|
-
activesupport (= 4.2.
|
123
|
+
railties (4.2.8)
|
124
|
+
actionpack (= 4.2.8)
|
125
|
+
activesupport (= 4.2.8)
|
127
126
|
rake (>= 0.8.7)
|
128
127
|
thor (>= 0.18.1, < 2.0)
|
129
|
-
rake (
|
130
|
-
rspec (
|
131
|
-
rspec-core (~>
|
132
|
-
rspec-expectations (~>
|
133
|
-
rspec-mocks (~>
|
134
|
-
rspec-core (
|
135
|
-
|
136
|
-
|
137
|
-
|
128
|
+
rake (12.0.0)
|
129
|
+
rspec (3.5.0)
|
130
|
+
rspec-core (~> 3.5.0)
|
131
|
+
rspec-expectations (~> 3.5.0)
|
132
|
+
rspec-mocks (~> 3.5.0)
|
133
|
+
rspec-core (3.5.4)
|
134
|
+
rspec-support (~> 3.5.0)
|
135
|
+
rspec-expectations (3.5.0)
|
136
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
+
rspec-support (~> 3.5.0)
|
138
|
+
rspec-mocks (3.5.0)
|
139
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
+
rspec-support (~> 3.5.0)
|
141
|
+
rspec-support (3.5.0)
|
138
142
|
safe_yaml (1.0.4)
|
139
|
-
sham_rack (1.
|
143
|
+
sham_rack (1.4.0)
|
140
144
|
rack
|
141
|
-
sinatra (1.
|
142
|
-
rack (~> 1.
|
143
|
-
rack-protection (~> 1.
|
144
|
-
tilt (
|
145
|
-
sprockets (3.
|
145
|
+
sinatra (1.4.8)
|
146
|
+
rack (~> 1.5)
|
147
|
+
rack-protection (~> 1.4)
|
148
|
+
tilt (>= 1.3, < 3)
|
149
|
+
sprockets (3.7.1)
|
146
150
|
concurrent-ruby (~> 1.0)
|
147
151
|
rack (> 1, < 3)
|
148
|
-
sprockets-rails (3.
|
152
|
+
sprockets-rails (3.2.0)
|
149
153
|
actionpack (>= 4.0)
|
150
154
|
activesupport (>= 4.0)
|
151
155
|
sprockets (>= 3.0.0)
|
152
|
-
sqlite3 (1.3.
|
156
|
+
sqlite3 (1.3.13)
|
153
157
|
thin (1.7.0)
|
154
158
|
daemons (~> 1.0, >= 1.0.9)
|
155
159
|
eventmachine (~> 1.0, >= 1.0.4)
|
156
160
|
rack (>= 1, < 3)
|
157
|
-
thor (0.19.
|
158
|
-
thread_safe (0.3.
|
159
|
-
tilt (
|
160
|
-
tzinfo (1.2.
|
161
|
+
thor (0.19.4)
|
162
|
+
thread_safe (0.3.6)
|
163
|
+
tilt (2.0.7)
|
164
|
+
tzinfo (1.2.3)
|
161
165
|
thread_safe (~> 0.1)
|
162
|
-
webmock (2.
|
166
|
+
webmock (2.3.2)
|
163
167
|
addressable (>= 2.3.6)
|
164
168
|
crack (>= 0.3.2)
|
165
169
|
hashdiff
|
166
|
-
yard (0.8
|
170
|
+
yard (0.9.8)
|
167
171
|
|
168
172
|
PLATFORMS
|
169
173
|
ruby
|
@@ -176,7 +180,7 @@ DEPENDENCIES
|
|
176
180
|
cucumber (~> 1.3.16)
|
177
181
|
rails (~> 4.2.6)
|
178
182
|
rake
|
179
|
-
rspec
|
183
|
+
rspec
|
180
184
|
sham_rack
|
181
185
|
sinatra
|
182
186
|
sqlite3
|
@@ -185,4 +189,4 @@ DEPENDENCIES
|
|
185
189
|
yard
|
186
190
|
|
187
191
|
BUNDLED WITH
|
188
|
-
1.14.
|
192
|
+
1.14.6
|
data/README.md
CHANGED
@@ -3,6 +3,36 @@ CopyTuner Client
|
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/SonicGarden/copy-tuner-ruby-client.svg?branch=master)](https://travis-ci.org/SonicGarden/copy-tuner-ruby-client)
|
5
5
|
|
6
|
+
## Getting started
|
7
|
+
|
8
|
+
Add it to your Gemfile
|
9
|
+
|
10
|
+
```
|
11
|
+
gem 'copy_tuner_client'
|
12
|
+
```
|
13
|
+
|
14
|
+
Create config/initializers/copy_tuner.rb
|
15
|
+
|
16
|
+
```
|
17
|
+
CopyTunerClient.configure do |config|
|
18
|
+
config.api_key = 'YOUR-API-KEY'
|
19
|
+
config.host = 'COPY-TUNER-HOST-NAME'
|
20
|
+
|
21
|
+
# I18n keys and messages will be sent to server if the locale matches
|
22
|
+
config.locales = [:ja, :en]
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
## CopyTunerの翻訳ファイルをymlとして出力する
|
27
|
+
|
28
|
+
該当のRailsプロジェクトで下記のrakeを実行する
|
29
|
+
|
30
|
+
```
|
31
|
+
bundle exec rake copy_tuner:export
|
32
|
+
```
|
33
|
+
|
34
|
+
これで、`config/locales/copy_tuner.yml` に翻訳ファイルが作成されます。
|
35
|
+
|
6
36
|
Development
|
7
37
|
=================
|
8
38
|
|
@@ -23,12 +53,3 @@ Development
|
|
23
53
|
$ bundle exec rake install # install to local gem
|
24
54
|
$ bundle exec rake release # release gem to rubygems.org
|
25
55
|
|
26
|
-
## CopyTunerの翻訳ファイルをymlとして出力する
|
27
|
-
|
28
|
-
該当のRailsプロジェクトで下記のrakeを実行する
|
29
|
-
|
30
|
-
```
|
31
|
-
bundle exec rake copy_tuner:export
|
32
|
-
```
|
33
|
-
|
34
|
-
これで、`config/locales/copy_tuner.yml` に翻訳ファイルが作成されます。
|
data/copy_tuner_client.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.add_development_dependency 'cucumber', '~> 1.3.16'
|
12
12
|
s.add_development_dependency 'rails', '~> 4.2.6'
|
13
13
|
s.add_development_dependency 'rake'
|
14
|
-
s.add_development_dependency 'rspec'
|
14
|
+
s.add_development_dependency 'rspec'
|
15
15
|
s.add_development_dependency 'sham_rack'
|
16
16
|
s.add_development_dependency 'sinatra'
|
17
17
|
s.add_development_dependency 'sqlite3'
|
@@ -53,7 +53,7 @@ end
|
|
53
53
|
|
54
54
|
Then /^the "([^"]*)" project should not have the "([^"]*)" blurb$/ do |api_key, blurb_key|
|
55
55
|
project = FakeCopyTunerApp.project(api_key)
|
56
|
-
project.draft[blurb_key].
|
56
|
+
expect(project.draft[blurb_key]).to be_nil
|
57
57
|
end
|
58
58
|
|
59
59
|
When /^I wait for changes to be synchronized$/ do
|
@@ -111,7 +111,7 @@ end
|
|
111
111
|
Then /^the log should contain "([^"]*)"$/ do |line|
|
112
112
|
prefix = "** [CopyTuner] "
|
113
113
|
pattern = Regexp.compile([Regexp.escape(prefix), Regexp.escape(line)].join(".*"))
|
114
|
-
log_path = "log/
|
114
|
+
log_path = "log/copy_tuner.log"
|
115
115
|
in_current_dir do
|
116
116
|
File.open(log_path) do |file|
|
117
117
|
unless file.readlines.any? { |file_line| file_line =~ pattern }
|
@@ -122,7 +122,7 @@ Then /^the log should contain "([^"]*)"$/ do |line|
|
|
122
122
|
end
|
123
123
|
|
124
124
|
Then /^the log should not contain "([^"]*)"$/ do |line|
|
125
|
-
log_path = "log/
|
125
|
+
log_path = "log/copy_tuner.log"
|
126
126
|
in_current_dir do
|
127
127
|
File.open(log_path) do |file|
|
128
128
|
if bad_line = file.readlines.detect { |file_line| file_line.include?(line) }
|
@@ -137,11 +137,11 @@ When /^I successfully rake "([^"]*)"$/ do |task|
|
|
137
137
|
end
|
138
138
|
|
139
139
|
Then /^the response should contain "([^"]+)"$/ do |text|
|
140
|
-
@last_response.body.
|
140
|
+
expect(@last_response.body).to include(text)
|
141
141
|
end
|
142
142
|
|
143
143
|
When /^show me the page$/ do
|
144
|
-
@last_response.body.
|
144
|
+
expect(@last_response.body).to be_nil
|
145
145
|
end
|
146
146
|
|
147
147
|
When /^I route the "([^"]+)" resource$/ do |resource|
|
data/gemfiles/4.1.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
@@ -20,7 +20,8 @@ module CopyTunerClient
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
if CopyTunerClient.configuration.enable_middleware?
|
23
|
-
|
23
|
+
alias_method :translate_without_copyray_comment, :translate
|
24
|
+
alias_method :translate, :translate_with_copyray_comment
|
24
25
|
alias :t :translate
|
25
26
|
end
|
26
27
|
end
|
@@ -22,7 +22,8 @@ if defined?(SimpleForm)
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
if CopyTunerClient.configuration.enable_middleware?
|
25
|
-
|
25
|
+
alias_method :label_translation_without_copyray_comment, :label_translation
|
26
|
+
alias_method :label_translation, :label_translation_with_copyray_comment
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -34,7 +34,8 @@ module CopyTunerClient
|
|
34
34
|
result
|
35
35
|
end
|
36
36
|
if CopyTunerClient.configuration.enable_middleware?
|
37
|
-
|
37
|
+
alias_method :translate_without_copy_tuner_hook, :translate
|
38
|
+
alias_method :translate, :translate_with_copy_tuner_hook
|
38
39
|
alias :t :translate
|
39
40
|
end
|
40
41
|
end
|
@@ -17,8 +17,8 @@ describe CopyTunerClient::Cache do
|
|
17
17
|
|
18
18
|
cache.download
|
19
19
|
|
20
|
-
cache['en.test.key'].
|
21
|
-
cache.keys.
|
20
|
+
expect(cache['en.test.key']).to eq('expected')
|
21
|
+
expect(cache.keys).to match_array(%w(en.test.key en.test.other_key))
|
22
22
|
end
|
23
23
|
|
24
24
|
it "exclude data if exclude_key_regexp is set" do
|
@@ -28,13 +28,13 @@ describe CopyTunerClient::Cache do
|
|
28
28
|
|
29
29
|
cache.download
|
30
30
|
|
31
|
-
cache.queued.keys.
|
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
|
35
35
|
cache = build_cache
|
36
36
|
cache.flush
|
37
|
-
client.
|
37
|
+
expect(client).not_to be_uploaded
|
38
38
|
end
|
39
39
|
|
40
40
|
it "uploads changes when flushed" do
|
@@ -43,7 +43,7 @@ describe CopyTunerClient::Cache do
|
|
43
43
|
|
44
44
|
cache.flush
|
45
45
|
|
46
|
-
client.uploaded.
|
46
|
+
expect(client.uploaded).to eq({ 'test.key' => 'test value' })
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'upload without locale filter' do
|
@@ -72,7 +72,7 @@ describe CopyTunerClient::Cache do
|
|
72
72
|
|
73
73
|
cache.download
|
74
74
|
|
75
|
-
cache['test.key'].
|
75
|
+
expect(cache['test.key']).to eq('test value')
|
76
76
|
end
|
77
77
|
|
78
78
|
it "downloads and uploads when synced" do
|
@@ -82,8 +82,8 @@ describe CopyTunerClient::Cache do
|
|
82
82
|
|
83
83
|
cache.sync
|
84
84
|
|
85
|
-
client.uploaded.
|
86
|
-
cache['test.key'].
|
85
|
+
expect(client.uploaded).to eq({ 'other.key' => 'other value' })
|
86
|
+
expect(cache['test.key']).to eq('test value')
|
87
87
|
end
|
88
88
|
|
89
89
|
it "handles connection errors when flushing" do
|
@@ -95,7 +95,7 @@ describe CopyTunerClient::Cache do
|
|
95
95
|
|
96
96
|
cache.flush
|
97
97
|
|
98
|
-
logger.
|
98
|
+
expect(logger).to have_entry(:error, failure)
|
99
99
|
end
|
100
100
|
|
101
101
|
it "handles connection errors when downloading" do
|
@@ -106,7 +106,7 @@ describe CopyTunerClient::Cache do
|
|
106
106
|
|
107
107
|
cache.download
|
108
108
|
|
109
|
-
logger.
|
109
|
+
expect(logger).to have_entry(:error, failure)
|
110
110
|
end
|
111
111
|
|
112
112
|
it "blocks until the first download is complete" do
|
@@ -125,7 +125,7 @@ describe CopyTunerClient::Cache do
|
|
125
125
|
|
126
126
|
sleep(1)
|
127
127
|
|
128
|
-
finished.
|
128
|
+
expect(finished).to eq(true)
|
129
129
|
# FIXME 成功したり、失敗していたりするので、一旦コメントアウト。後で直します。
|
130
130
|
# logger.should have_entry(:info, "Waiting for first download")
|
131
131
|
# logger.should have_received(:flush)
|
@@ -147,7 +147,7 @@ describe CopyTunerClient::Cache do
|
|
147
147
|
sleep(1)
|
148
148
|
|
149
149
|
expect { cache.download }.to raise_error(StandardError, "Failure")
|
150
|
-
finished.
|
150
|
+
expect(finished).to eq(true)
|
151
151
|
end
|
152
152
|
|
153
153
|
it "doesn't block before downloading" do
|
@@ -162,8 +162,8 @@ describe CopyTunerClient::Cache do
|
|
162
162
|
|
163
163
|
sleep(1)
|
164
164
|
|
165
|
-
finished.
|
166
|
-
logger.
|
165
|
+
expect(finished).to eq(true)
|
166
|
+
expect(logger).not_to have_entry(:info, "Waiting for first download")
|
167
167
|
end
|
168
168
|
|
169
169
|
it "doesn't return blank copy" do
|
@@ -172,7 +172,7 @@ describe CopyTunerClient::Cache do
|
|
172
172
|
|
173
173
|
cache.download
|
174
174
|
|
175
|
-
cache['en.test.key'].
|
175
|
+
expect(cache['en.test.key']).to be_nil
|
176
176
|
end
|
177
177
|
|
178
178
|
describe "given locked mutex" do
|
@@ -199,7 +199,7 @@ describe CopyTunerClient::Cache do
|
|
199
199
|
false
|
200
200
|
end
|
201
201
|
|
202
|
-
|
202
|
+
failure_message do
|
203
203
|
@failure_message
|
204
204
|
end
|
205
205
|
end
|
@@ -213,15 +213,15 @@ describe CopyTunerClient::Cache do
|
|
213
213
|
end
|
214
214
|
|
215
215
|
it "synchronizes read access to keys between threads" do
|
216
|
-
Thread.new { cache['test.key'] }.
|
216
|
+
expect(Thread.new { cache['test.key'] }).to finish_after_unlocking(mutex)
|
217
217
|
end
|
218
218
|
|
219
219
|
it "synchronizes read access to the key list between threads" do
|
220
|
-
Thread.new { cache.keys }.
|
220
|
+
expect(Thread.new { cache.keys }).to finish_after_unlocking(mutex)
|
221
221
|
end
|
222
222
|
|
223
223
|
it "synchronizes write access to keys between threads" do
|
224
|
-
Thread.new { cache['test.key'] = 'value' }.
|
224
|
+
expect(Thread.new { cache['test.key'] = 'value' }).to finish_after_unlocking(mutex)
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
@@ -255,11 +255,11 @@ describe CopyTunerClient::Cache do
|
|
255
255
|
|
256
256
|
CopyTunerClient.export
|
257
257
|
|
258
|
-
@cache.
|
258
|
+
expect(@cache).to have_received(:export)
|
259
259
|
end
|
260
260
|
|
261
261
|
it "returns no yaml with no blurb keys" do
|
262
|
-
@cache.export.
|
262
|
+
expect(@cache.export).to eq(nil)
|
263
263
|
end
|
264
264
|
|
265
265
|
context "with single-level blurb keys" do
|
@@ -270,8 +270,8 @@ describe CopyTunerClient::Cache do
|
|
270
270
|
|
271
271
|
it "returns blurbs as yaml" do
|
272
272
|
exported = YAML.load(@cache.export)
|
273
|
-
exported['key'].
|
274
|
-
exported['other_key'].
|
273
|
+
expect(exported['key']).to eq('test value')
|
274
|
+
expect(exported['other_key']).to eq('other test value')
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
@@ -284,9 +284,9 @@ describe CopyTunerClient::Cache do
|
|
284
284
|
|
285
285
|
it "returns blurbs as yaml" do
|
286
286
|
exported = YAML.load(@cache.export)
|
287
|
-
exported['en']['test']['key'].
|
288
|
-
exported['en']['test']['other_key'].
|
289
|
-
exported['fr']['test']['key'].
|
287
|
+
expect(exported['en']['test']['key']).to eq('en test value')
|
288
|
+
expect(exported['en']['test']['other_key']).to eq('en other test value')
|
289
|
+
expect(exported['fr']['test']['key']).to eq('fr test value')
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
@@ -298,7 +298,7 @@ describe CopyTunerClient::Cache do
|
|
298
298
|
|
299
299
|
it "retains the new key" do
|
300
300
|
exported = YAML.load(@cache.export)
|
301
|
-
exported['en']['test']['key'].
|
301
|
+
expect(exported['en']['test']['key']).to eq('other test value')
|
302
302
|
end
|
303
303
|
end
|
304
304
|
end
|