copy_tuner_client 0.3.4 → 0.3.5

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.
@@ -31,29 +31,29 @@ describe CopyTunerClient do
31
31
  project = add_project
32
32
  client = build_client(:api_key => project.api_key, :http_open_timeout => 4)
33
33
  client.download { |ignore| }
34
- http.open_timeout.should == 4
34
+ expect(http.open_timeout).to eq(4)
35
35
  end
36
36
 
37
37
  it 'should timeout when reading' do
38
38
  project = add_project
39
39
  client = build_client(:api_key => project.api_key, :http_read_timeout => 4)
40
40
  client.download { |ignore| }
41
- http.read_timeout.should == 4
41
+ expect(http.read_timeout).to eq(4)
42
42
  end
43
43
 
44
44
  it 'uses verified ssl when secure' do
45
45
  project = add_project
46
46
  client = build_client(:api_key => project.api_key, :secure => true)
47
47
  client.download { |ignore| }
48
- http.use_ssl?.should == true
49
- http.verify_mode.should == OpenSSL::SSL::VERIFY_PEER
48
+ expect(http.use_ssl?).to eq(true)
49
+ expect(http.verify_mode).to eq(OpenSSL::SSL::VERIFY_PEER)
50
50
  end
51
51
 
52
52
  it 'does not use ssl when insecure' do
53
53
  project = add_project
54
54
  client = build_client(:api_key => project.api_key, :secure => false)
55
55
  client.download { |ignore| }
56
- http.use_ssl?.should == false
56
+ expect(http.use_ssl?).to eq(false)
57
57
  end
58
58
 
59
59
  it 'wraps HTTP errors with ConnectionError' do
@@ -75,8 +75,8 @@ describe CopyTunerClient do
75
75
  client = build_client_with_project
76
76
  expect { client.download { |ignore| } }.
77
77
  to raise_error(CopyTunerClient::ConnectionError) { |error|
78
- error.message.
79
- should == "#{original_error.class.name}: #{original_error.message}"
78
+ expect(error.message).
79
+ to eq("#{original_error.class.name}: #{original_error.message}")
80
80
  }
81
81
  end
82
82
  end
@@ -121,17 +121,17 @@ describe CopyTunerClient do
121
121
 
122
122
  client.download { |yielded| blurbs = yielded }
123
123
 
124
- blurbs.should == {
124
+ expect(blurbs).to eq({
125
125
  'key.one' => 'expected one',
126
126
  'key.two' => 'expected two'
127
- }
127
+ })
128
128
  end
129
129
 
130
130
  it 'logs that it performed a download' do
131
131
  logger = FakeLogger.new
132
132
  client = build_client_with_project(:logger => logger)
133
133
  client.download { |ignore| }
134
- logger.should have_entry(:info, 'Downloaded translations')
134
+ expect(logger).to have_entry(:info, 'Downloaded translations')
135
135
  end
136
136
 
137
137
  it 'downloads draft blurbs for an existing project' do
@@ -151,10 +151,10 @@ describe CopyTunerClient do
151
151
 
152
152
  client.download { |yielded| blurbs = yielded }
153
153
 
154
- blurbs.should == {
154
+ expect(blurbs).to eq({
155
155
  'key.one' => 'expected one',
156
156
  'key.two' => 'expected two'
157
- }
157
+ })
158
158
  end
159
159
 
160
160
  it "handles a 304 response when downloading" do
@@ -170,8 +170,8 @@ describe CopyTunerClient do
170
170
  client.download { |ignore| yields += 1 }
171
171
  end
172
172
 
173
- yields.should == 1
174
- logger.should have_entry(:info, "No new translations")
173
+ expect(yields).to eq(1)
174
+ expect(logger).to have_entry(:info, "No new translations")
175
175
  end
176
176
 
177
177
  it "uploads defaults for missing blurbs in an existing project" do
@@ -185,14 +185,14 @@ describe CopyTunerClient do
185
185
  client = build_client(:api_key => project.api_key, :public => true)
186
186
  client.upload(blurbs)
187
187
 
188
- project.reload.draft.should == blurbs
188
+ expect(project.reload.draft).to eq(blurbs)
189
189
  end
190
190
 
191
191
  it "logs that it performed an upload" do
192
192
  logger = FakeLogger.new
193
193
  client = build_client_with_project(:logger => logger)
194
194
  client.upload({})
195
- logger.should have_entry(:info, "Uploaded missing translations")
195
+ expect(logger).to have_entry(:info, "Uploaded missing translations")
196
196
  end
197
197
 
198
198
  it "deploys from the top-level constant" do
@@ -204,7 +204,7 @@ describe CopyTunerClient do
204
204
 
205
205
  CopyTunerClient.deploy
206
206
 
207
- client.should have_received(:deploy)
207
+ expect(client).to have_received(:deploy)
208
208
  end
209
209
 
210
210
  it "deploys" do
@@ -224,11 +224,11 @@ describe CopyTunerClient do
224
224
 
225
225
  client.deploy
226
226
 
227
- project.reload.published.should == {
227
+ expect(project.reload.published).to eq({
228
228
  'key.one' => "expected one",
229
229
  'key.two' => "expected two"
230
- }
231
- logger.should have_entry(:info, "Deployed")
230
+ })
231
+ expect(logger).to have_entry(:info, "Deployed")
232
232
  end
233
233
 
234
234
  it "handles deploy errors" do
@@ -3,16 +3,16 @@ require 'spec_helper'
3
3
  describe CopyTunerClient::Configuration do
4
4
  RSpec::Matchers.define :have_config_option do |option|
5
5
  match do |config|
6
- config.should respond_to(option)
6
+ expect(config).to respond_to(option)
7
7
 
8
8
  if instance_variables.include?(:'@default')
9
- config.send(option).should == @default
9
+ expect(config.send(option)).to eq(@default)
10
10
  end
11
11
 
12
12
  if @overridable
13
13
  value = 'a value'
14
14
  config.send(:"#{option}=", value)
15
- config.send(option).should == value
15
+ expect(config.send(option)).to eq(value)
16
16
  end
17
17
  end
18
18
 
@@ -25,39 +25,39 @@ describe CopyTunerClient::Configuration do
25
25
  end
26
26
  end
27
27
 
28
- it { should have_config_option(:proxy_host).overridable.default(nil) }
29
- it { should have_config_option(:proxy_port).overridable.default(nil) }
30
- it { should have_config_option(:proxy_user).overridable.default(nil) }
31
- it { should have_config_option(:proxy_pass).overridable.default(nil) }
32
- it { should have_config_option(:environment_name).overridable.default(nil) }
33
- it { should have_config_option(:client_version).overridable.default(CopyTunerClient::VERSION) }
34
- it { should have_config_option(:client_name).overridable.default('CopyTuner Client') }
35
- it { should have_config_option(:client_url).overridable.default('https://rubygems.org/gems/copy_tuner_client') }
36
- it { should have_config_option(:secure).overridable.default(true) }
37
- it { should have_config_option(:host).overridable.default('copy-tuner.com') }
38
- it { should have_config_option(:http_open_timeout).overridable.default(5) }
39
- it { should have_config_option(:http_read_timeout).overridable.default(5) }
40
- it { should have_config_option(:port).overridable }
41
- it { should have_config_option(:development_environments).overridable }
42
- it { should have_config_option(:api_key).overridable }
43
- it { should have_config_option(:polling_delay).overridable.default(300) }
44
- it { should have_config_option(:framework).overridable }
45
- it { should have_config_option(:middleware).overridable }
46
- it { should have_config_option(:client).overridable }
47
- it { should have_config_option(:cache).overridable }
28
+ it { is_expected.to have_config_option(:proxy_host).overridable.default(nil) }
29
+ it { is_expected.to have_config_option(:proxy_port).overridable.default(nil) }
30
+ it { is_expected.to have_config_option(:proxy_user).overridable.default(nil) }
31
+ it { is_expected.to have_config_option(:proxy_pass).overridable.default(nil) }
32
+ it { is_expected.to have_config_option(:environment_name).overridable.default(nil) }
33
+ it { is_expected.to have_config_option(:client_version).overridable.default(CopyTunerClient::VERSION) }
34
+ it { is_expected.to have_config_option(:client_name).overridable.default('CopyTuner Client') }
35
+ it { is_expected.to have_config_option(:client_url).overridable.default('https://rubygems.org/gems/copy_tuner_client') }
36
+ it { is_expected.to have_config_option(:secure).overridable.default(true) }
37
+ it { is_expected.to have_config_option(:host).overridable.default('copy-tuner.com') }
38
+ it { is_expected.to have_config_option(:http_open_timeout).overridable.default(5) }
39
+ it { is_expected.to have_config_option(:http_read_timeout).overridable.default(5) }
40
+ it { is_expected.to have_config_option(:port).overridable }
41
+ it { is_expected.to have_config_option(:development_environments).overridable }
42
+ it { is_expected.to have_config_option(:api_key).overridable }
43
+ it { is_expected.to have_config_option(:polling_delay).overridable.default(300) }
44
+ it { is_expected.to have_config_option(:framework).overridable }
45
+ it { is_expected.to have_config_option(:middleware).overridable }
46
+ it { is_expected.to have_config_option(:client).overridable }
47
+ it { is_expected.to have_config_option(:cache).overridable }
48
48
 
49
49
  it 'should provide default values for secure connections' do
50
50
  config = CopyTunerClient::Configuration.new
51
51
  config.secure = true
52
- config.port.should == 443
53
- config.protocol.should == 'https'
52
+ expect(config.port).to eq(443)
53
+ expect(config.protocol).to eq('https')
54
54
  end
55
55
 
56
56
  it 'should provide default values for insecure connections' do
57
57
  config = CopyTunerClient::Configuration.new
58
58
  config.secure = false
59
- config.port.should == 80
60
- config.protocol.should == 'http'
59
+ expect(config.port).to eq(80)
60
+ expect(config.protocol).to eq('http')
61
61
  end
62
62
 
63
63
  it 'should not cache inferred ports' do
@@ -65,7 +65,7 @@ describe CopyTunerClient::Configuration do
65
65
  config.secure = false
66
66
  config.port
67
67
  config.secure = true
68
- config.port.should == 443
68
+ expect(config.port).to eq(443)
69
69
  end
70
70
 
71
71
  it 'should act like a hash' do
@@ -76,54 +76,54 @@ describe CopyTunerClient::Configuration do
76
76
  :http_read_timeout, :client_name, :client_url, :client_version, :port,
77
77
  :protocol, :proxy_host, :proxy_pass, :proxy_port, :proxy_user, :secure,
78
78
  :development_environments, :logger, :framework, :ca_file].each do |option|
79
- hash[option].should == config[option]
79
+ expect(hash[option]).to eq(config[option])
80
80
  end
81
81
 
82
- hash[:public].should == config.public?
82
+ expect(hash[:public]).to eq(config.public?)
83
83
  end
84
84
 
85
85
  it 'should be mergable' do
86
86
  config = CopyTunerClient::Configuration.new
87
87
  hash = config.to_hash
88
- config.merge(:key => 'value').should == hash.merge(:key => 'value')
88
+ expect(config.merge(:key => 'value')).to eq(hash.merge(:key => 'value'))
89
89
  end
90
90
 
91
91
  it 'should use development and staging as development environments by default' do
92
92
  config = CopyTunerClient::Configuration.new
93
- config.development_environments.should match_array(%w(development staging))
93
+ expect(config.development_environments).to match_array(%w(development staging))
94
94
  end
95
95
 
96
96
  it 'should use test and cucumber as test environments by default' do
97
97
  config = CopyTunerClient::Configuration.new
98
- config.test_environments.should match_array(%w(test cucumber))
98
+ expect(config.test_environments).to match_array(%w(test cucumber))
99
99
  end
100
100
 
101
101
  it 'should be test in a test environment' do
102
102
  config = CopyTunerClient::Configuration.new
103
103
  config.test_environments = %w(test)
104
104
  config.environment_name = 'test'
105
- config.should be_test
105
+ expect(config).to be_test
106
106
  end
107
107
 
108
108
  it 'should be public in a public environment' do
109
109
  config = CopyTunerClient::Configuration.new
110
110
  config.development_environments = %w(development)
111
111
  config.environment_name = 'production'
112
- config.should be_public
113
- config.should_not be_development
112
+ expect(config).to be_public
113
+ expect(config).not_to be_development
114
114
  end
115
115
 
116
116
  it 'should be development in a development environment' do
117
117
  config = CopyTunerClient::Configuration.new
118
118
  config.development_environments = %w(staging)
119
119
  config.environment_name = 'staging'
120
- config.should be_development
121
- config.should_not be_public
120
+ expect(config).to be_development
121
+ expect(config).not_to be_public
122
122
  end
123
123
 
124
124
  it 'should be public without an environment name' do
125
125
  config = CopyTunerClient::Configuration.new
126
- config.should be_public
126
+ expect(config).to be_public
127
127
  end
128
128
 
129
129
  it 'should yield and save a configuration when configuring' do
@@ -133,15 +133,15 @@ describe CopyTunerClient::Configuration do
133
133
  yielded_configuration = config
134
134
  end
135
135
 
136
- yielded_configuration.should be_kind_of(CopyTunerClient::Configuration)
137
- CopyTunerClient.configuration.should == yielded_configuration
136
+ expect(yielded_configuration).to be_kind_of(CopyTunerClient::Configuration)
137
+ expect(CopyTunerClient.configuration).to eq(yielded_configuration)
138
138
  end
139
139
 
140
140
  it 'does not apply the configuration when asked not to' do
141
141
  logger = FakeLogger.new
142
142
  CopyTunerClient.configure(false) { |config| config.logger = logger }
143
- CopyTunerClient.configuration.should_not be_applied
144
- logger.entries[:info].should be_empty
143
+ expect(CopyTunerClient.configuration).not_to be_applied
144
+ expect(logger.entries[:info]).to be_empty
145
145
  end
146
146
 
147
147
  it 'should not remove existing config options when configuring twice' do
@@ -152,32 +152,32 @@ describe CopyTunerClient::Configuration do
152
152
  end
153
153
 
154
154
  CopyTunerClient.configure(false) do |config|
155
- config.should == first_config
155
+ expect(config).to eq(first_config)
156
156
  end
157
157
  end
158
158
 
159
159
  it 'starts out unapplied' do
160
- CopyTunerClient::Configuration.new.should_not be_applied
160
+ expect(CopyTunerClient::Configuration.new).not_to be_applied
161
161
  end
162
162
 
163
163
  it 'logs to $stdout by default' do
164
164
  logger = FakeLogger.new
165
165
  Logger.stubs :new => logger
166
166
  config = CopyTunerClient::Configuration.new
167
- Logger.should have_received(:new).with($stdout)
168
- config.logger.original_logger.should == logger
167
+ expect(Logger).to have_received(:new).with($stdout)
168
+ expect(config.logger.original_logger).to eq(logger)
169
169
  end
170
170
 
171
171
  it 'generates environment info without a framework' do
172
172
  subject.environment_name = 'production'
173
- subject.environment_info.should == "[Ruby: #{RUBY_VERSION}] [Env: production]"
173
+ expect(subject.environment_info).to eq("[Ruby: #{RUBY_VERSION}] [Env: production]")
174
174
  end
175
175
 
176
176
  it 'generates environment info with a framework' do
177
177
  subject.environment_name = 'production'
178
178
  subject.framework = 'Sinatra: 1.0.0'
179
- subject.environment_info.
180
- should == "[Ruby: #{RUBY_VERSION}] [Sinatra: 1.0.0] [Env: production]"
179
+ expect(subject.environment_info).
180
+ to eq("[Ruby: #{RUBY_VERSION}] [Sinatra: 1.0.0] [Env: production]")
181
181
  end
182
182
 
183
183
  it 'prefixes log entries' do
@@ -187,8 +187,8 @@ describe CopyTunerClient::Configuration do
187
187
  config.logger = logger
188
188
 
189
189
  prefixed_logger = config.logger
190
- prefixed_logger.should be_a(CopyTunerClient::PrefixedLogger)
191
- prefixed_logger.original_logger.should == logger
190
+ expect(prefixed_logger).to be_a(CopyTunerClient::PrefixedLogger)
191
+ expect(prefixed_logger.original_logger).to eq(logger)
192
192
  end
193
193
 
194
194
  describe 'copyray_js_injection_regexp_for_debug' do
@@ -227,35 +227,35 @@ end
227
227
  shared_examples_for 'applied configuration' do
228
228
  include_context 'stubbed configuration'
229
229
 
230
- it { should be_applied }
230
+ it { is_expected.to be_applied }
231
231
 
232
232
  it 'builds and assigns an I18n backend' do
233
- CopyTunerClient::I18nBackend.should have_received(:new).with(cache)
234
- I18n.backend.should == backend
233
+ expect(CopyTunerClient::I18nBackend).to have_received(:new).with(cache)
234
+ expect(I18n.backend).to eq(backend)
235
235
  end
236
236
 
237
237
  it 'builds and assigns a poller' do
238
- CopyTunerClient::Poller.should have_received(:new).with(cache, subject.to_hash)
238
+ expect(CopyTunerClient::Poller).to have_received(:new).with(cache, subject.to_hash)
239
239
  end
240
240
 
241
241
  it 'builds a process guard' do
242
- CopyTunerClient::ProcessGuard.should have_received(:new).
242
+ expect(CopyTunerClient::ProcessGuard).to have_received(:new).
243
243
  with(cache, poller, subject.to_hash)
244
244
  end
245
245
 
246
246
  it 'logs that it is ready' do
247
- logger.should have_entry(:info, "Client #{CopyTunerClient::VERSION} ready")
247
+ expect(logger).to have_entry(:info, "Client #{CopyTunerClient::VERSION} ready")
248
248
  end
249
249
 
250
250
  it 'logs environment info' do
251
- logger.should have_entry(:info, "Environment Info: #{subject.environment_info}")
251
+ expect(logger).to have_entry(:info, "Environment Info: #{subject.environment_info}")
252
252
  end
253
253
  end
254
254
 
255
255
  describe CopyTunerClient::Configuration, 'applied when testing' do
256
256
  it_should_behave_like 'applied configuration' do
257
257
  it 'does not start the process guard' do
258
- process_guard.should have_received(:start).never
258
+ expect(process_guard).to have_received(:start).never
259
259
  end
260
260
  end
261
261
 
@@ -268,7 +268,7 @@ end
268
268
  describe CopyTunerClient::Configuration, 'applied when not testing' do
269
269
  it_should_behave_like 'applied configuration' do
270
270
  it 'starts the process guard' do
271
- process_guard.should have_received(:start)
271
+ expect(process_guard).to have_received(:start)
272
272
  end
273
273
  end
274
274
 
@@ -281,7 +281,7 @@ end
281
281
  describe CopyTunerClient::Configuration, 'applied when developing with middleware' do
282
282
  it_should_behave_like 'applied configuration' do
283
283
  it 'adds the sync middleware' do
284
- middleware.should include(CopyTunerClient::RequestSync)
284
+ expect(middleware).to include(CopyTunerClient::RequestSync)
285
285
  end
286
286
  end
287
287
 
@@ -316,7 +316,7 @@ describe CopyTunerClient::Configuration, 'applied with middleware when not devel
316
316
  end
317
317
 
318
318
  it 'does not add the sync middleware' do
319
- middleware.should_not include(CopyTunerClient::RequestSync)
319
+ expect(middleware).not_to include(CopyTunerClient::RequestSync)
320
320
  end
321
321
  end
322
322
 
@@ -23,12 +23,12 @@ describe CopyTunerClient::I18nBackend do
23
23
  subject.reload!
24
24
  subject.translate('en', 'test.key', :default => 'something')
25
25
 
26
- cache.should have_received(:wait_for_download)
27
- I18n.should have_received(:load_path)
26
+ expect(cache).to have_received(:wait_for_download)
27
+ expect(I18n).to have_received(:load_path)
28
28
  end
29
29
 
30
30
  it "includes the base i18n backend" do
31
- should be_kind_of(I18n::Backend::Base)
31
+ is_expected.to be_kind_of(I18n::Backend::Base)
32
32
  end
33
33
 
34
34
  it "looks up a key in cache" do
@@ -37,7 +37,7 @@ describe CopyTunerClient::I18nBackend do
37
37
 
38
38
  backend = build_backend
39
39
 
40
- backend.translate('en', 'test.key', :scope => 'prefix').should == value
40
+ expect(backend.translate('en', 'test.key', :scope => 'prefix')).to eq(value)
41
41
  end
42
42
 
43
43
  it "finds available locales from locale files and cache" do
@@ -47,44 +47,44 @@ describe CopyTunerClient::I18nBackend do
47
47
  cache['en.key'] = ''
48
48
  cache['fr.key'] = ''
49
49
 
50
- subject.available_locales.should match_array([:en, :es, :fr])
50
+ expect(subject.available_locales).to match_array([:en, :es, :fr])
51
51
  end
52
52
 
53
53
  it "queues missing keys with default" do
54
54
  default = 'default value'
55
55
 
56
- subject.translate('en', 'test.key', :default => default).should == default
56
+ expect(subject.translate('en', 'test.key', :default => default)).to eq(default)
57
57
 
58
- cache['en.test.key'].should == default
58
+ expect(cache['en.test.key']).to eq(default)
59
59
  end
60
60
 
61
61
  it "queues missing keys without default" do
62
62
  expect { subject.translate('en', 'test.key') }.
63
63
  to throw_symbol(:exception)
64
64
 
65
- cache['en.test.key'].should == ""
65
+ expect(cache['en.test.key']).to eq("")
66
66
  end
67
67
 
68
68
  it "queues missing keys with scope" do
69
69
  default = 'default value'
70
70
 
71
- subject.translate('en', 'key', :default => default, :scope => ['test']).
72
- should == default
71
+ expect(subject.translate('en', 'key', :default => default, :scope => ['test'])).
72
+ to eq(default)
73
73
 
74
- cache['en.test.key'].should == default
74
+ expect(cache['en.test.key']).to eq(default)
75
75
  end
76
76
 
77
77
  it "marks strings as html safe" do
78
78
  cache['en.test.key'] = FakeHtmlSafeString.new("Hello")
79
79
  backend = build_backend
80
- backend.translate('en', 'test.key').should be_html_safe
80
+ expect(backend.translate('en', 'test.key')).to be_html_safe
81
81
  end
82
82
 
83
83
  it "looks up an array of defaults" do
84
84
  cache['en.key.one'] = "Expected"
85
85
  backend = build_backend
86
- backend.translate('en', 'key.three', :default => [:"key.two", :"key.one"]).
87
- should == 'Expected'
86
+ expect(backend.translate('en', 'key.three', :default => [:"key.two", :"key.one"])).
87
+ to eq('Expected')
88
88
  end
89
89
 
90
90
  describe "with stored translations" do
@@ -92,48 +92,48 @@ describe CopyTunerClient::I18nBackend do
92
92
 
93
93
  it "uses stored translations as a default" do
94
94
  subject.store_translations('en', 'test' => { 'key' => 'Expected' })
95
- subject.translate('en', 'test.key', :default => 'Unexpected').
96
- should include('Expected')
97
- cache['en.test.key'].should == 'Expected'
95
+ expect(subject.translate('en', 'test.key', :default => 'Unexpected')).
96
+ to include('Expected')
97
+ expect(cache['en.test.key']).to eq('Expected')
98
98
  end
99
99
 
100
100
  it "preserves interpolation markers in the stored translation" do
101
101
  subject.store_translations('en', 'test' => { 'key' => '%{interpolate}' })
102
- subject.translate('en', 'test.key', :interpolate => 'interpolated').
103
- should include('interpolated')
104
- cache['en.test.key'].should == '%{interpolate}'
102
+ expect(subject.translate('en', 'test.key', :interpolate => 'interpolated')).
103
+ to include('interpolated')
104
+ expect(cache['en.test.key']).to eq('%{interpolate}')
105
105
  end
106
106
 
107
107
  it "uses the default if the stored translations don't have the key" do
108
- subject.translate('en', 'test.key', :default => 'Expected').
109
- should include('Expected')
108
+ expect(subject.translate('en', 'test.key', :default => 'Expected')).
109
+ to include('Expected')
110
110
  end
111
111
 
112
112
  it "uses the cached key when present" do
113
113
  subject.store_translations('en', 'test' => { 'key' => 'Unexpected' })
114
114
  cache['en.test.key'] = 'Expected'
115
- subject.translate('en', 'test.key', :default => 'default').
116
- should include('Expected')
115
+ expect(subject.translate('en', 'test.key', :default => 'default')).
116
+ to include('Expected')
117
117
  end
118
118
 
119
119
  it "stores a nested hash" do
120
120
  nested = { :nested => 'value' }
121
121
  subject.store_translations('en', 'key' => nested)
122
- subject.translate('en', 'key', :default => 'Unexpected').should == nested
123
- cache['en.key.nested'].should == 'value'
122
+ expect(subject.translate('en', 'key', :default => 'Unexpected')).to eq(nested)
123
+ expect(cache['en.key.nested']).to eq('value')
124
124
  end
125
125
 
126
126
  it "returns an array directly without storing" do
127
127
  array = ['value']
128
128
  subject.store_translations('en', 'key' => array)
129
- subject.translate('en', 'key', :default => 'Unexpected').should == array
130
- cache['en.key'].should be_nil
129
+ expect(subject.translate('en', 'key', :default => 'Unexpected')).to eq(array)
130
+ expect(cache['en.key']).to be_nil
131
131
  end
132
132
 
133
133
  it "looks up an array of defaults" do
134
134
  subject.store_translations('en', 'key' => { 'one' => 'Expected' })
135
- subject.translate('en', 'key.three', :default => [:"key.two", :"key.one"]).
136
- should include('Expected')
135
+ expect(subject.translate('en', 'key.three', :default => [:"key.two", :"key.one"])).
136
+ to include('Expected')
137
137
  end
138
138
  end
139
139
 
@@ -148,11 +148,11 @@ describe CopyTunerClient::I18nBackend do
148
148
 
149
149
  it "queues missing keys with blank string" do
150
150
  default = 'default value'
151
- subject.translate('en', 'test.key', :default => default).should == default
151
+ expect(subject.translate('en', 'test.key', :default => default)).to eq(default)
152
152
 
153
153
  # default と Fallbacks を併用した場合、キャッシュにデフォルト値は入らない仕様に変えた
154
154
  # その仕様にしないと、うまく Fallbacks の処理が動かないため
155
- cache['en.test.key'].should == ''
155
+ expect(cache['en.test.key']).to eq('')
156
156
  end
157
157
  end
158
158
  end
@@ -34,7 +34,7 @@ describe CopyTunerClient::Poller do
34
34
  client['test.key'] = 'value'
35
35
  wait_for_next_sync
36
36
 
37
- cache['test.key'].should == 'value'
37
+ expect(cache['test.key']).to eq('value')
38
38
  end
39
39
 
40
40
  it "it doesn't poll before being started" do
@@ -43,7 +43,7 @@ describe CopyTunerClient::Poller do
43
43
 
44
44
  wait_for_next_sync
45
45
 
46
- cache['test.key'].should be_nil
46
+ expect(cache['test.key']).to be_nil
47
47
  end
48
48
 
49
49
  it "stops polling when stopped" do
@@ -55,7 +55,7 @@ describe CopyTunerClient::Poller do
55
55
  client['test.key'] = 'value'
56
56
  wait_for_next_sync
57
57
 
58
- cache['test.key'].should be_nil
58
+ expect(cache['test.key']).to be_nil
59
59
  end
60
60
 
61
61
  it "stops polling with an invalid api key" do
@@ -68,12 +68,12 @@ describe CopyTunerClient::Poller do
68
68
  poller.start
69
69
  wait_for_next_sync
70
70
 
71
- logger.should have_entry(:error, failure)
71
+ expect(logger).to have_entry(:error, failure)
72
72
 
73
73
  client['test.key'] = 'test value'
74
74
  wait_for_next_sync
75
75
 
76
- cache['test.key'].should be_nil
76
+ expect(cache['test.key']).to be_nil
77
77
  end
78
78
 
79
79
  it "logs an error if the background thread can't start" do
@@ -82,7 +82,7 @@ describe CopyTunerClient::Poller do
82
82
 
83
83
  build_poller(:logger => logger).start
84
84
 
85
- logger.should have_entry(:error, "Couldn't start poller thread")
85
+ expect(logger).to have_entry(:error, "Couldn't start poller thread")
86
86
  end
87
87
 
88
88
  it "flushes the log when polling" do
@@ -93,7 +93,7 @@ describe CopyTunerClient::Poller do
93
93
 
94
94
  wait_for_next_sync
95
95
 
96
- logger.should have_received(:flush).at_least_once
96
+ expect(logger).to have_received(:flush).at_least_once
97
97
  end
98
98
 
99
99
  it "starts from the top-level constant" do
@@ -103,6 +103,6 @@ describe CopyTunerClient::Poller do
103
103
 
104
104
  CopyTunerClient.start_poller
105
105
 
106
- poller.should have_received(:start)
106
+ expect(poller).to have_received(:start)
107
107
  end
108
108
  end