localeapp 0.6.13 → 0.6.14

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 CHANGED
@@ -1,8 +1,15 @@
1
1
  # master
2
2
 
3
+ # Version 0.6.14
4
+
5
+ * Fix a bug where the last poll and last refresh date could be nil
6
+
7
+ # Version 0.6.13
8
+
9
+ * Respect the `scope` option when contructing translations
10
+
3
11
  # Version 0.6.12
4
12
 
5
- * Respect the `scopez option when contructing translations
6
13
  * Specify that the MIT license is used
7
14
 
8
15
  # Version 0.6.12
@@ -13,15 +13,16 @@ module Localeapp
13
13
  attr_accessor :updated_at
14
14
 
15
15
  def initialize
16
- @polled_at = synchronization_data[:polled_at] || 0
17
- @updated_at = synchronization_data[:updated_at] || 0
16
+ @polled_at = synchronization_data[:polled_at]
17
+ @updated_at = synchronization_data[:updated_at]
18
18
  end
19
19
 
20
20
  def synchronization_data
21
21
  if File.exists?(Localeapp.configuration.synchronization_data_file)
22
- Localeapp.load_yaml_file(Localeapp.configuration.synchronization_data_file) || {}
22
+ Localeapp.load_yaml_file(Localeapp.configuration.synchronization_data_file) ||
23
+ default_synchronization_data
23
24
  else
24
- {}
25
+ default_synchronization_data
25
26
  end
26
27
  end
27
28
 
@@ -68,5 +69,9 @@ module Localeapp
68
69
  def current_time
69
70
  Time.now
70
71
  end
72
+
73
+ def default_synchronization_data
74
+ {:polled_at => 0, :updated_at => 0}
75
+ end
71
76
  end
72
77
  end
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = "0.6.13"
2
+ VERSION = "0.6.14"
3
3
  end
@@ -25,13 +25,20 @@ describe Localeapp::Poller do
25
25
  end
26
26
 
27
27
  describe "#synchronization_data" do
28
+ let(:default_data) { {:polled_at => 0, :updated_at => 0} }
29
+
28
30
  before do
29
31
  @original_configuration_file = Localeapp.configuration.synchronization_data_file
32
+ end
33
+
34
+ it "returns default data if there is a yml file that is empty" do
30
35
  Localeapp.configuration.synchronization_data_file = "#{File.dirname(__FILE__)}/../fixtures/empty_log.yml"
36
+ @poller.synchronization_data.should == default_data
31
37
  end
32
38
 
33
- it "returns an empty hash if there is a yml file that is empty" do
34
- @poller.synchronization_data.should == {}
39
+ it "returns default data when the yml file doesn't exist" do
40
+ Localeapp.configuration.synchronization_data_file = "non_existant_file.yml"
41
+ @poller.synchronization_data.should == default_data
35
42
  end
36
43
 
37
44
  after do
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 13
10
- version: 0.6.13
9
+ - 14
10
+ version: 0.6.14
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: 2013-10-04 00:00:00 Z
19
+ date: 2013-10-21 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: i18n