localeapp 0.9.3 → 1.0.0
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 +8 -8
- data/.travis.yml +5 -1
- data/CHANGELOG.md +10 -0
- data/README.md +2 -2
- data/bin/localeapp +6 -4
- data/features/add.feature +11 -12
- data/features/install.feature +28 -28
- data/features/mv.feature +2 -2
- data/features/pull.feature +8 -8
- data/features/push.feature +12 -12
- data/features/rm.feature +2 -2
- data/features/step_definitions/cli_steps.rb +2 -6
- data/features/support/env.rb +3 -5
- data/features/support/hooks.rb +3 -3
- data/features/update.feature +19 -19
- data/lib/localeapp/version.rb +1 -1
- data/localeapp.gemspec +4 -4
- data/spec/localeapp/api_call_spec.rb +2 -2
- data/spec/localeapp/api_caller_spec.rb +45 -43
- data/spec/localeapp/cli/add_spec.rb +14 -14
- data/spec/localeapp/cli/daemon_spec.rb +6 -6
- data/spec/localeapp/cli/install_spec.rb +53 -53
- data/spec/localeapp/cli/pull_spec.rb +5 -5
- data/spec/localeapp/cli/push_spec.rb +9 -9
- data/spec/localeapp/cli/rename_spec.rb +1 -1
- data/spec/localeapp/cli/update_spec.rb +9 -6
- data/spec/localeapp/configuration_spec.rb +29 -29
- data/spec/localeapp/default_value_handler_spec.rb +8 -8
- data/spec/localeapp/exception_handler_spec.rb +6 -6
- data/spec/localeapp/key_checker_spec.rb +2 -2
- data/spec/localeapp/missing_translations_spec.rb +18 -18
- data/spec/localeapp/poller_spec.rb +12 -12
- data/spec/localeapp/rails/controller_spec.rb +13 -13
- data/spec/localeapp/routes_spec.rb +34 -34
- data/spec/localeapp/sender_spec.rb +5 -5
- data/spec/localeapp/updater_spec.rb +14 -14
- metadata +15 -15
@@ -8,14 +8,14 @@ describe Localeapp::CLI::Install, '.execute(key = nil)' do
|
|
8
8
|
|
9
9
|
it "creates the installer based on the config type" do
|
10
10
|
command.config_type = :heroku
|
11
|
-
command.
|
11
|
+
expect(command).to receive(:installer).with("HerokuInstaller").and_return(double.as_null_object)
|
12
12
|
command.execute(key)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "executes the installer with the given key" do
|
16
16
|
installer = double(:installer)
|
17
|
-
installer.
|
18
|
-
command.
|
17
|
+
expect(installer).to receive(:execute).with(key)
|
18
|
+
allow(command).to receive(:installer).and_return(installer)
|
19
19
|
command.execute(key)
|
20
20
|
end
|
21
21
|
end
|
@@ -26,58 +26,58 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#execute(key = nil)' do
|
|
26
26
|
let(:installer) { Localeapp::CLI::Install::DefaultInstaller.new(output) }
|
27
27
|
|
28
28
|
before do
|
29
|
-
installer.
|
30
|
-
installer.
|
29
|
+
allow(installer).to receive(:print_header)
|
30
|
+
allow(installer).to receive(:validate_key).and_return(false)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "prints the header" do
|
34
|
-
installer.
|
34
|
+
expect(installer).to receive(:print_header)
|
35
35
|
installer.execute
|
36
36
|
end
|
37
37
|
|
38
38
|
it "validates the key" do
|
39
|
-
installer.
|
40
|
-
installer.
|
39
|
+
expect(installer).to receive(:key=).with(key)
|
40
|
+
expect(installer).to receive(:validate_key)
|
41
41
|
installer.execute(key)
|
42
42
|
end
|
43
43
|
|
44
44
|
context "When key validation fails" do
|
45
45
|
it "returns false" do
|
46
|
-
installer.execute(key).
|
46
|
+
expect(installer.execute(key)).to eq(false)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
context "When key validation is successful" do
|
51
51
|
before do
|
52
|
-
installer.
|
53
|
-
installer.
|
54
|
-
installer.
|
55
|
-
installer.
|
56
|
-
installer.
|
52
|
+
allow(installer).to receive(:validate_key).and_return(true)
|
53
|
+
allow(installer).to receive(:check_default_locale)
|
54
|
+
allow(installer).to receive(:set_config_paths)
|
55
|
+
allow(installer).to receive(:write_config_file)
|
56
|
+
allow(installer).to receive(:check_data_directory_exists)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "checks the default locale" do
|
60
|
-
installer.
|
60
|
+
expect(installer).to receive(:check_default_locale)
|
61
61
|
installer.execute(key)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "sets the configuration paths" do
|
65
|
-
installer.
|
65
|
+
expect(installer).to receive(:set_config_paths)
|
66
66
|
installer.execute(key)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "writes the configuration file" do
|
70
|
-
installer.
|
70
|
+
expect(installer).to receive(:write_config_file)
|
71
71
|
installer.execute(key)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "checks the data directory exists" do
|
75
|
-
installer.
|
75
|
+
expect(installer).to receive(:check_data_directory_exists)
|
76
76
|
installer.execute(key)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "returns true" do
|
80
|
-
installer.execute(key).
|
80
|
+
expect(installer.execute(key)).to eq(true)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -94,19 +94,19 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#validate_key(key)' do
|
|
94
94
|
it "displays error if key is nil" do
|
95
95
|
installer.key = nil
|
96
96
|
installer.validate_key
|
97
|
-
output.string.
|
97
|
+
expect(output.string).to match(/You must supply an API key/)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "displays error if the key is there but isn't valid on localeapp.com" do
|
101
|
-
installer.
|
101
|
+
allow(installer).to receive(:check_key).and_return([false, {}])
|
102
102
|
installer.validate_key
|
103
|
-
output.string.
|
103
|
+
expect(output.string).to match(/Project not found/)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "displays project name if the key is there and valid on localeapp.com" do
|
107
|
-
installer.
|
107
|
+
allow(installer).to receive(:check_key).and_return([true, valid_project_data])
|
108
108
|
installer.validate_key
|
109
|
-
output.string.
|
109
|
+
expect(output.string).to match(/Test Project/)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -115,18 +115,18 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#check_default_locale' do
|
|
115
115
|
let(:installer) { Localeapp::CLI::Install::DefaultInstaller.new(output) }
|
116
116
|
|
117
117
|
before do
|
118
|
-
installer.
|
118
|
+
allow(installer).to receive(:project_data).and_return(valid_project_data)
|
119
119
|
end
|
120
120
|
|
121
121
|
it "displays project base locale" do
|
122
122
|
installer.check_default_locale
|
123
|
-
output.string.
|
123
|
+
expect(output.string).to match(/en \(English\)/)
|
124
124
|
end
|
125
125
|
|
126
126
|
it "displays warning if I18n.default_locale doesn't match what's configured on localeapp.com" do
|
127
|
-
I18n.
|
127
|
+
allow(I18n).to receive(:default_locale).and_return(:es)
|
128
128
|
installer.check_default_locale
|
129
|
-
output.string.
|
129
|
+
expect(output.string).to match(%r{WARNING: I18n.default_locale is es, change in config/environment.rb \(Rails 2\) or config/application.rb \(Rails 3\)})
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -139,11 +139,11 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#set_config_paths' do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
it "sets the initializer config_file_path for a rails app" do
|
142
|
-
installer.config_file_path.
|
142
|
+
expect(installer.config_file_path).to eq("config/initializers/localeapp.rb")
|
143
143
|
end
|
144
144
|
|
145
145
|
it "sets the data directory for a rails app" do
|
146
|
-
installer.data_directory.
|
146
|
+
expect(installer.data_directory).to eq("config/locales")
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -157,14 +157,14 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#write_config_file' do
|
|
157
157
|
installer.key = key
|
158
158
|
installer.config_file_path = config_file_path
|
159
159
|
file = double('file')
|
160
|
-
file.
|
160
|
+
expect(file).to receive(:write).with <<-CONTENT
|
161
161
|
require 'localeapp/rails'
|
162
162
|
|
163
163
|
Localeapp.configure do |config|
|
164
164
|
config.api_key = 'APIKEY'
|
165
165
|
end
|
166
166
|
CONTENT
|
167
|
-
File.
|
167
|
+
expect(File).to receive(:open).with(config_file_path, 'w+').and_yield(file)
|
168
168
|
installer.write_config_file
|
169
169
|
end
|
170
170
|
end
|
@@ -179,15 +179,15 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#check_data_directory_exist
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "displays warning if config.translation_data_directory doesn't exist" do
|
182
|
-
File.
|
182
|
+
allow(File).to receive(:directory?).with(data_directory).and_return(false)
|
183
183
|
installer.check_data_directory_exists
|
184
|
-
output.string.
|
184
|
+
expect(output.string).to match(/Your translation data will be stored there./)
|
185
185
|
end
|
186
186
|
|
187
187
|
it "doesn't display a warning if translation_data_directory exists" do
|
188
|
-
File.
|
188
|
+
allow(File).to receive(:directory?).with(data_directory).and_return(true)
|
189
189
|
installer.check_data_directory_exists
|
190
|
-
output.string.
|
190
|
+
expect(output.string).to eq('')
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -201,7 +201,7 @@ describe Localeapp::CLI::Install::HerokuInstaller, '#write_config_file' do
|
|
201
201
|
installer.key = key
|
202
202
|
installer.config_file_path = config_file_path
|
203
203
|
file = double('file')
|
204
|
-
file.
|
204
|
+
expect(file).to receive(:write).with <<-CONTENT
|
205
205
|
require 'localeapp/rails'
|
206
206
|
|
207
207
|
Localeapp.configure do |config|
|
@@ -217,7 +217,7 @@ if defined?(Rails) && Rails.env.staging?
|
|
217
217
|
Localeapp::CLI::Pull.new.execute
|
218
218
|
end
|
219
219
|
CONTENT
|
220
|
-
File.
|
220
|
+
expect(File).to receive(:open).with(config_file_path, 'w+').and_yield(file)
|
221
221
|
installer.write_config_file
|
222
222
|
end
|
223
223
|
end
|
@@ -227,7 +227,7 @@ describe Localeapp::CLI::Install::StandaloneInstaller, '#check_default_locale' d
|
|
227
227
|
|
228
228
|
it "does nothing" do
|
229
229
|
installer.check_default_locale
|
230
|
-
output.string.
|
230
|
+
expect(output.string).to eq('')
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
@@ -240,11 +240,11 @@ describe Localeapp::CLI::Install::StandaloneInstaller, '#set_config_paths' do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
it "sets the initializer config_file_path for a standalone app" do
|
243
|
-
installer.config_file_path.
|
243
|
+
expect(installer.config_file_path).to eq(".localeapp/config.rb")
|
244
244
|
end
|
245
245
|
|
246
246
|
it "sets the data directory for a standalone app" do
|
247
|
-
installer.data_directory.
|
247
|
+
expect(installer.data_directory).to eq("locales")
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -256,12 +256,12 @@ describe Localeapp::CLI::Install::StandaloneInstaller, '#write_config_file' do
|
|
256
256
|
let(:installer) { Localeapp::CLI::Install::StandaloneInstaller.new(output) }
|
257
257
|
|
258
258
|
it "creates a configuration file containing the dot file configuration at the given config_file_path" do
|
259
|
-
installer.
|
259
|
+
allow(installer).to receive(:create_config_dir).and_return(File.dirname(config_file_path))
|
260
260
|
installer.key = key
|
261
261
|
installer.config_file_path = config_file_path
|
262
262
|
installer.data_directory = data_directory
|
263
263
|
file = double('file')
|
264
|
-
file.
|
264
|
+
expect(file).to receive(:write).with <<-CONTENT
|
265
265
|
Localeapp.configure do |config|
|
266
266
|
config.api_key = 'APIKEY'
|
267
267
|
config.translation_data_directory = 'locales'
|
@@ -269,7 +269,7 @@ Localeapp.configure do |config|
|
|
269
269
|
config.daemon_pid_file = '.localeapp/localeapp.pid'
|
270
270
|
end
|
271
271
|
CONTENT
|
272
|
-
File.
|
272
|
+
expect(File).to receive(:open).with(config_file_path, 'w+').and_yield(file)
|
273
273
|
installer.write_config_file
|
274
274
|
end
|
275
275
|
end
|
@@ -285,30 +285,30 @@ describe Localeapp::CLI::Install::GithubInstaller, '#write_config_file' do
|
|
285
285
|
installer.key = key
|
286
286
|
installer.config_file_path = config_file_path
|
287
287
|
installer.data_directory = data_directory
|
288
|
-
installer.
|
289
|
-
installer.
|
290
|
-
installer.
|
291
|
-
installer.
|
292
|
-
installer.
|
288
|
+
allow(installer).to receive(:create_config_dir).and_return(File.dirname(config_file_path))
|
289
|
+
allow(installer).to receive(:write_standalone_config)
|
290
|
+
allow(installer).to receive(:create_data_directory)
|
291
|
+
allow(installer).to receive(:create_gitignore)
|
292
|
+
allow(installer).to receive(:create_readme)
|
293
293
|
end
|
294
294
|
|
295
295
|
it "creates a standalone configuration file" do
|
296
|
-
installer.
|
296
|
+
expect(installer).to receive(:write_standalone_config)
|
297
297
|
installer.write_config_file
|
298
298
|
end
|
299
299
|
|
300
300
|
it "creates the data_directory" do
|
301
|
-
installer.
|
301
|
+
expect(installer).to receive(:create_data_directory)
|
302
302
|
installer.write_config_file
|
303
303
|
end
|
304
304
|
|
305
305
|
it "creates the .gitignore file" do
|
306
|
-
installer.
|
306
|
+
expect(installer).to receive(:create_gitignore)
|
307
307
|
installer.write_config_file
|
308
308
|
end
|
309
309
|
|
310
310
|
it "creates the READMI file" do
|
311
|
-
installer.
|
311
|
+
expect(installer).to receive(:create_readme)
|
312
312
|
installer.write_config_file
|
313
313
|
end
|
314
314
|
end
|
@@ -9,7 +9,7 @@ describe Localeapp::CLI::Pull, "#execute" do
|
|
9
9
|
|
10
10
|
it "makes the api call to the translations endpoint" do
|
11
11
|
with_configuration do
|
12
|
-
@puller.
|
12
|
+
expect(@puller).to receive(:api_call).with(
|
13
13
|
:export,
|
14
14
|
:success => :update_backend,
|
15
15
|
:failure => :report_failure,
|
@@ -29,16 +29,16 @@ describe Localeapp::CLI::Pull, "#update_backend(response)" do
|
|
29
29
|
|
30
30
|
it "calls the updater" do
|
31
31
|
with_configuration do
|
32
|
-
Localeapp.poller.
|
33
|
-
Localeapp.updater.
|
32
|
+
allow(Localeapp.poller).to receive(:write_synchronization_data!)
|
33
|
+
expect(Localeapp.updater).to receive(:dump).with(['test data'])
|
34
34
|
@puller.update_backend(@test_data)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
it "writes the synchronization data" do
|
39
39
|
with_configuration do
|
40
|
-
Localeapp.updater.
|
41
|
-
Localeapp.poller.
|
40
|
+
allow(Localeapp.updater).to receive(:dump)
|
41
|
+
expect(Localeapp.poller).to receive(:write_synchronization_data!)
|
42
42
|
@puller.update_backend(@test_data)
|
43
43
|
end
|
44
44
|
end
|
@@ -10,10 +10,10 @@ describe Localeapp::CLI::Push, "#execute(path)" do
|
|
10
10
|
directory = double('directory')
|
11
11
|
path = 'test_path'
|
12
12
|
yaml_files = %w(en.yml es.yml)
|
13
|
-
pusher.
|
14
|
-
pusher.
|
15
|
-
pusher.
|
16
|
-
pusher.
|
13
|
+
allow(pusher).to receive(:path_is_directory?).and_return(true)
|
14
|
+
expect(pusher).to receive(:yaml_files_in_directory).with(path).and_return(yaml_files)
|
15
|
+
expect(pusher).to receive(:push_file).with('en.yml')
|
16
|
+
expect(pusher).to receive(:push_file).with('es.yml')
|
17
17
|
pusher.execute(path)
|
18
18
|
end
|
19
19
|
end
|
@@ -24,7 +24,7 @@ describe Localeapp::CLI::Push, "#execute(path)" do
|
|
24
24
|
with_configuration do
|
25
25
|
file = double('file')
|
26
26
|
file_path = 'test_path'
|
27
|
-
pusher.
|
27
|
+
expect(pusher).to receive(:push_file).with(file_path)
|
28
28
|
pusher.execute(file_path)
|
29
29
|
end
|
30
30
|
end
|
@@ -39,8 +39,8 @@ describe Localeapp::CLI::Push, "#push_file(file_path)" do
|
|
39
39
|
with_configuration do
|
40
40
|
file = double('file')
|
41
41
|
file_path = 'test_path'
|
42
|
-
pusher.
|
43
|
-
pusher.
|
42
|
+
allow(pusher).to receive(:sanitize_file).and_return(file)
|
43
|
+
expect(pusher).to receive(:api_call).with(
|
44
44
|
:import,
|
45
45
|
:payload => { :file => file },
|
46
46
|
:success => :report_success,
|
@@ -52,8 +52,8 @@ describe Localeapp::CLI::Push, "#push_file(file_path)" do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "doesn't make the api call when the file doesn't exist" do
|
55
|
-
pusher.
|
56
|
-
pusher.
|
55
|
+
allow(pusher).to receive(:sanitize_file).and_return(nil)
|
56
|
+
expect(pusher).not_to receive(:api_call)
|
57
57
|
pusher.push_file('foo')
|
58
58
|
end
|
59
59
|
end
|
@@ -12,7 +12,7 @@ describe Localeapp::CLI::Add, "#execute(current_name, new_name, *rest)" do
|
|
12
12
|
|
13
13
|
it "makes the api call to the translations endpoint with the new name as the post body" do
|
14
14
|
with_configuration do
|
15
|
-
@command.
|
15
|
+
expect(@command).to receive(:api_call).with(
|
16
16
|
:rename,
|
17
17
|
:url_options => { :current_name => 'test.key' },
|
18
18
|
:payload => { :new_name => 'test.new_name' },
|
@@ -6,32 +6,35 @@ describe Localeapp::CLI::Update, "#execute" do
|
|
6
6
|
let(:updater) { Localeapp::CLI::Update.new(:output => output) }
|
7
7
|
let(:poller) { Localeapp::Poller.new }
|
8
8
|
|
9
|
-
before
|
9
|
+
before do
|
10
|
+
poller
|
11
|
+
allow(Localeapp::Poller).to receive(:new) { poller }
|
12
|
+
end
|
10
13
|
|
11
14
|
context "when timestamp is recent" do
|
12
|
-
before
|
15
|
+
before { allow(poller).to receive(:updated_at) { Time.now.to_i - 60 } }
|
13
16
|
|
14
17
|
it "creates a Poller and calls poll! on it" do
|
15
18
|
with_configuration do
|
16
|
-
poller.
|
19
|
+
expect(poller).to receive(:poll!)
|
17
20
|
updater.execute
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
22
25
|
context "when timestamp is too old" do
|
23
|
-
before
|
26
|
+
before { allow(poller).to receive(:updated_at) { 0 } }
|
24
27
|
|
25
28
|
it "warns the user" do
|
26
29
|
with_configuration do
|
27
30
|
updater.execute
|
28
|
-
output.string.
|
31
|
+
expect(output.string).to include("Timestamp is missing or too old.")
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
35
|
it "does not even call the API" do
|
33
36
|
with_configuration do
|
34
|
-
poller.
|
37
|
+
expect(poller).not_to receive(:poll!)
|
35
38
|
updater.execute
|
36
39
|
end
|
37
40
|
end
|
@@ -4,7 +4,7 @@ describe Localeapp::Configuration do
|
|
4
4
|
let(:configuration) { Localeapp::Configuration.new }
|
5
5
|
|
6
6
|
it "sets the host by default" do
|
7
|
-
configuration.host.
|
7
|
+
expect(configuration.host).to eq('api.localeapp.com')
|
8
8
|
end
|
9
9
|
|
10
10
|
it "allows the host to be overwritten" do
|
@@ -12,7 +12,7 @@ describe Localeapp::Configuration do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "sets proxy to nil by default" do
|
15
|
-
configuration.proxy.
|
15
|
+
expect(configuration.proxy).to eq(nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "allows proxy setting to be overridden" do
|
@@ -20,7 +20,7 @@ describe Localeapp::Configuration do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "sets timeout to 60 by default" do
|
23
|
-
configuration.timeout.
|
23
|
+
expect(configuration.timeout).to eq(60)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "allows timeout setting to be overridden" do
|
@@ -28,7 +28,7 @@ describe Localeapp::Configuration do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "sets secure to true by default" do
|
31
|
-
configuration.secure.
|
31
|
+
expect(configuration.secure).to eq(true)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "allows secure setting to be overridden" do
|
@@ -36,11 +36,11 @@ describe Localeapp::Configuration do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "sets ssl_verify to false by default" do
|
39
|
-
configuration.ssl_verify.
|
39
|
+
expect(configuration.ssl_verify).to eq(false)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "sets ssl_version to 'SSLv23' by default" do
|
43
|
-
configuration.ssl_version.
|
43
|
+
expect(configuration.ssl_version).to eq('SSLv23')
|
44
44
|
end
|
45
45
|
|
46
46
|
it "allows ssl_verify setting to be overridden" do
|
@@ -48,7 +48,7 @@ describe Localeapp::Configuration do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "sets ssl_ca_file to nil by default" do
|
51
|
-
configuration.ssl_ca_file.
|
51
|
+
expect(configuration.ssl_ca_file).to eq(nil)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "allows ssl_ca_file setting to be overridden" do
|
@@ -56,25 +56,25 @@ describe Localeapp::Configuration do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "includes http_auth_username defaulting to nil" do
|
59
|
-
configuration.http_auth_username.
|
59
|
+
expect(configuration.http_auth_username).to eq(nil)
|
60
60
|
configuration.http_auth_username = "test"
|
61
|
-
configuration.http_auth_username.
|
61
|
+
expect(configuration.http_auth_username).to eq("test")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "includes http_auth_password defaulting to nil" do
|
65
|
-
configuration.http_auth_password.
|
65
|
+
expect(configuration.http_auth_password).to eq(nil)
|
66
66
|
configuration.http_auth_password = "test"
|
67
|
-
configuration.http_auth_password.
|
67
|
+
expect(configuration.http_auth_password).to eq("test")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "includes translation_data_directory defaulting to config/locales" do
|
71
|
-
configuration.translation_data_directory.
|
71
|
+
expect(configuration.translation_data_directory).to eq(File.join("config", "locales"))
|
72
72
|
configuration.translation_data_directory = "test"
|
73
|
-
configuration.translation_data_directory.
|
73
|
+
expect(configuration.translation_data_directory).to eq("test")
|
74
74
|
end
|
75
75
|
|
76
76
|
it "sets the daemon_pid_file by default" do
|
77
|
-
configuration.daemon_pid_file.
|
77
|
+
expect(configuration.daemon_pid_file).to eq('tmp/pids/localeapp.pid')
|
78
78
|
end
|
79
79
|
|
80
80
|
it "allows the daemon_pid_file to be overwritten" do
|
@@ -82,7 +82,7 @@ describe Localeapp::Configuration do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it "sets the daemon_log_file by default" do
|
85
|
-
configuration.daemon_log_file.
|
85
|
+
expect(configuration.daemon_log_file).to eq('log/localeapp_daemon.log')
|
86
86
|
end
|
87
87
|
|
88
88
|
it "allows the daemon_log_file to be overwritten" do
|
@@ -95,19 +95,19 @@ describe Localeapp::Configuration do
|
|
95
95
|
|
96
96
|
context "enabled_sending_environments" do
|
97
97
|
it "is only development by default" do
|
98
|
-
configuration.sending_environments.
|
98
|
+
expect(configuration.sending_environments).to eq(['development'])
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
context "enabled_reloading_environments" do
|
103
103
|
it "is only development by default" do
|
104
|
-
configuration.reloading_environments.
|
104
|
+
expect(configuration.reloading_environments).to eq(['development'])
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
context "enabled_polling_environments" do
|
109
109
|
it "is only development by default" do
|
110
|
-
configuration.polling_environments.
|
110
|
+
expect(configuration.polling_environments).to eq(['development'])
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
@@ -115,19 +115,19 @@ describe Localeapp::Configuration do
|
|
115
115
|
it "is true when environment is not enabled" do
|
116
116
|
configuration.polling_environments = %w(foo)
|
117
117
|
configuration.environment_name = 'bar'
|
118
|
-
configuration.
|
118
|
+
expect(configuration).to be_polling_disabled
|
119
119
|
end
|
120
120
|
|
121
121
|
it "is false when environment is enabled" do
|
122
122
|
configuration.polling_environments = %w(foo)
|
123
123
|
configuration.environment_name = 'foo'
|
124
|
-
configuration.
|
124
|
+
expect(configuration).not_to be_polling_disabled
|
125
125
|
end
|
126
126
|
|
127
127
|
it "supports symbols in list of environments" do
|
128
128
|
configuration.polling_environments = [:foo]
|
129
129
|
configuration.environment_name = 'foo'
|
130
|
-
configuration.
|
130
|
+
expect(configuration).not_to be_polling_disabled
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -135,19 +135,19 @@ describe Localeapp::Configuration do
|
|
135
135
|
it "is true when environment is not enabled" do
|
136
136
|
configuration.reloading_environments = %w(foo)
|
137
137
|
configuration.environment_name = 'bar'
|
138
|
-
configuration.
|
138
|
+
expect(configuration).to be_reloading_disabled
|
139
139
|
end
|
140
140
|
|
141
141
|
it "is false when environment is enabled" do
|
142
142
|
configuration.reloading_environments = %w(foo)
|
143
143
|
configuration.environment_name = 'foo'
|
144
|
-
configuration.
|
144
|
+
expect(configuration).not_to be_reloading_disabled
|
145
145
|
end
|
146
146
|
|
147
147
|
it "supports symbols in list of environments" do
|
148
148
|
configuration.reloading_environments = [:foo]
|
149
149
|
configuration.environment_name = 'foo'
|
150
|
-
configuration.
|
150
|
+
expect(configuration).not_to be_reloading_disabled
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -155,19 +155,19 @@ describe Localeapp::Configuration do
|
|
155
155
|
it "is true when environment is not enabled" do
|
156
156
|
configuration.sending_environments = %w(foo)
|
157
157
|
configuration.environment_name = 'bar'
|
158
|
-
configuration.
|
158
|
+
expect(configuration).to be_sending_disabled
|
159
159
|
end
|
160
160
|
|
161
161
|
it "is false when environment is enabled" do
|
162
162
|
configuration.sending_environments = %w(foo)
|
163
163
|
configuration.environment_name = 'foo'
|
164
|
-
configuration.
|
164
|
+
expect(configuration).not_to be_sending_disabled
|
165
165
|
end
|
166
166
|
|
167
167
|
it "supports symbols in the list of environments" do
|
168
168
|
configuration.sending_environments = [:foo]
|
169
169
|
configuration.environment_name = 'foo'
|
170
|
-
configuration.
|
170
|
+
expect(configuration).not_to be_sending_disabled
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
@@ -176,13 +176,13 @@ describe Localeapp::Configuration do
|
|
176
176
|
context "when an api_key is defined" do
|
177
177
|
it "returns true" do
|
178
178
|
configuration.api_key = '0123456789abcdef'
|
179
|
-
expect(configuration.has_api_key?).to
|
179
|
+
expect(configuration.has_api_key?).to be true
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
context "with no api_key provided" do
|
184
184
|
it "returns false" do
|
185
|
-
expect(configuration.has_api_key?).to
|
185
|
+
expect(configuration.has_api_key?).to be false
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|