localeapp 0.3.0 → 0.3.1
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.
- data/CHANGELOG.md +6 -0
- data/features/localeapp_binary.feature +1 -1
- data/lib/localeapp/api_caller.rb +3 -0
- data/lib/localeapp/poller.rb +1 -1
- data/lib/localeapp/version.rb +1 -1
- data/spec/fixtures/empty_log.yml +0 -0
- data/spec/localeapp/api_caller_spec.rb +8 -1
- data/spec/localeapp/poller_spec.rb +15 -0
- metadata +6 -4
data/CHANGELOG.md
CHANGED
data/lib/localeapp/api_caller.rb
CHANGED
@@ -70,6 +70,9 @@ module Localeapp
|
|
70
70
|
rescue Errno::ECONNREFUSED => error
|
71
71
|
Localeapp.debug("ERROR: Connection Refused")
|
72
72
|
return NonHTTPResponse.new(-1)
|
73
|
+
rescue SocketError => error
|
74
|
+
Localeapp.debug("ERROR: Socket Error #{error.message}")
|
75
|
+
return NonHTTPResponse.new(-1)
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
data/lib/localeapp/poller.rb
CHANGED
@@ -19,7 +19,7 @@ module Localeapp
|
|
19
19
|
|
20
20
|
def synchronization_data
|
21
21
|
if File.exists?(Localeapp.configuration.synchronization_data_file)
|
22
|
-
YAML.load_file(Localeapp.configuration.synchronization_data_file)
|
22
|
+
YAML.load_file(Localeapp.configuration.synchronization_data_file) || {}
|
23
23
|
else
|
24
24
|
{}
|
25
25
|
end
|
data/lib/localeapp/version.rb
CHANGED
File without changes
|
@@ -199,7 +199,14 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
199
199
|
end
|
200
200
|
|
201
201
|
it "handles ECONNREFUSED" do
|
202
|
-
RestClient.stub(:
|
202
|
+
RestClient::Request.stub(:execute).and_raise(Errno::ECONNREFUSED)
|
203
|
+
@api_caller.options[:failure] = :fail
|
204
|
+
@object.should_receive(:fail)
|
205
|
+
@api_caller.call(@object)
|
206
|
+
end
|
207
|
+
|
208
|
+
it "handles SocketError" do
|
209
|
+
RestClient::Request.stub(:execute).and_raise(SocketError)
|
203
210
|
@api_caller.options[:failure] = :fail
|
204
211
|
@object.should_receive(:fail)
|
205
212
|
@api_caller.call(@object)
|
@@ -24,6 +24,21 @@ describe Localeapp::Poller do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
describe "#synchronization_data" do
|
28
|
+
before do
|
29
|
+
@original_configuration_file = Localeapp.configuration.synchronization_data_file
|
30
|
+
Localeapp.configuration.synchronization_data_file = "#{File.dirname(__FILE__)}/../fixtures/empty_log.yml"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns an empty hash if there is a yml file that is empty" do
|
34
|
+
@poller.synchronization_data.should == {}
|
35
|
+
end
|
36
|
+
|
37
|
+
after do
|
38
|
+
Localeapp.configuration.synchronization_data_file = @original_configuration_file
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
27
42
|
describe "#write_synchronization_data!(polled_at, updated_at)" do
|
28
43
|
it "updates polled_at in the synchronization file" do
|
29
44
|
polled_at = lambda { @poller.synchronization_data[:polled_at] }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localeapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christopher Dell
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-12-09 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: i18n
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/localeapp/version.rb
|
238
238
|
- localeapp.gemspec
|
239
239
|
- run_ci
|
240
|
+
- spec/fixtures/empty_log.yml
|
240
241
|
- spec/fixtures/en.yml
|
241
242
|
- spec/fixtures/es.yml
|
242
243
|
- spec/localeapp/api_call_spec.rb
|
@@ -297,6 +298,7 @@ test_files:
|
|
297
298
|
- features/step_definitions/cli_steps.rb
|
298
299
|
- features/support/env.rb
|
299
300
|
- features/support/hooks.rb
|
301
|
+
- spec/fixtures/empty_log.yml
|
300
302
|
- spec/fixtures/en.yml
|
301
303
|
- spec/fixtures/es.yml
|
302
304
|
- spec/localeapp/api_call_spec.rb
|