working_hours 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2504840e341046d817df5de9c4e7d8271e192177
4
- data.tar.gz: 2a97bd89965b04bd6b68c1bdcaf90a27ca0ae2ec
3
+ metadata.gz: af58b9235b85d46bc35cc76ceb72bf755c074923
4
+ data.tar.gz: dd5e22bc13e5659507f189ed586327a9ad199f5b
5
5
  SHA512:
6
- metadata.gz: 213aed1c4be42b0ff98a9e926253941da1cc4e05bfc85be8d3ca77e51082b87da00da0169410e16c3045366eaf0c202fd7c352d000df19d0edeee3c4b89fa976
7
- data.tar.gz: 016639b14b4a5ec24be13ea3415223fef1c7743c04654e23c2346ecaaef4d83c9985c3a63f4786c4430e4b087a3b95b0a04b5ae80ab538dfe186ce4ac26d294f
6
+ metadata.gz: e09fc30b112ad6a69e45b64b6b0559ab82a4b09137c89a5598b86c22e3a2bc4f371790d9a941d0fb5bf993ed18248e8975c4ca01310ff0099bc88c3b734298fe
7
+ data.tar.gz: e6312bdfccd80b1a19ffe5f8bb48a0c461bc71f0fa821fa1cd9b203780f72ab72c7c023e5bfa7e0b730eca3a1d596ddb312782d3c83a08326f83bd32107af010
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Unreleased
2
2
 
3
- [Compare master with v1.0.0](https://github.com/intrepidd/working_hours/compare/v1.0.0...master)
3
+ [Compare master with v1.0.1](https://github.com/intrepidd/working_hours/compare/v1.0.1...master)
4
+
5
+ # v1.0.1
6
+
7
+ * Fix bug when calling ``1.working.hour.ago`` would return a time in your system zone instead of the configured time zone. This was due to a conversion to Time that loses the timezone information. We'll now return an ``ActiveSupport::TimeWithZone``.
8
+
9
+ _10/10/2014_
4
10
 
5
11
  # v1.0.0
6
12
 
@@ -12,4 +18,4 @@ _15/09/2014_
12
18
 
13
19
  * First beta release
14
20
 
15
- _24/08/2014_
21
+ _24/08/2014_
@@ -187,7 +187,6 @@ module WorkingHours
187
187
  case original
188
188
  when Date then time.to_date
189
189
  when DateTime then time.to_datetime
190
- when Time then time.to_time
191
190
  else time
192
191
  end
193
192
  end
@@ -1,3 +1,3 @@
1
1
  module WorkingHours
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -130,6 +130,11 @@ describe WorkingHours::Computation do
130
130
  expect(advance_to_working_time(Time.new(2014, 4, 7, 0, 0, 0 , "-09:00"))).to eq(Time.utc(2014, 4, 7, 9))
131
131
  expect(advance_to_working_time(Time.new(2014, 4, 7, 22, 0, 0 , "+02:00"))).to eq(Time.utc(2014, 4, 8, 9))
132
132
  end
133
+
134
+ it 'returns time in config zone' do
135
+ WorkingHours::Config.time_zone = 'Tokyo'
136
+ expect(advance_to_working_time(Time.new(2014, 4, 7, 0, 0, 0)).zone).to eq('JST')
137
+ end
133
138
  end
134
139
 
135
140
  describe '#return_to_working_time' do
@@ -162,6 +167,11 @@ describe WorkingHours::Computation do
162
167
  expect(return_to_working_time(Time.new(2014, 4, 7, 1, 0, 0 , "-09:00"))).to eq(Time.utc(2014, 4, 7, 10))
163
168
  expect(return_to_working_time(Time.new(2014, 4, 7, 22, 0, 0 , "+02:00"))).to eq(Time.utc(2014, 4, 7, 17))
164
169
  end
170
+
171
+ it 'returns time in config zone' do
172
+ WorkingHours::Config.time_zone = 'Tokyo'
173
+ expect(return_to_working_time(Time.new(2014, 4, 7, 1, 0, 0)).zone).to eq('JST')
174
+ end
165
175
  end
166
176
 
167
177
  describe '#working_day?' do
@@ -57,6 +57,11 @@ describe WorkingHours::Duration do
57
57
  it "accepts reference time as argument" do
58
58
  expect(1.working.day.since(Time.utc(1991, 11, 15, 21))).to eq(Time.utc(1991, 11, 18, 21))
59
59
  end
60
+
61
+ it 'returns time in config zone' do
62
+ WorkingHours::Config.time_zone = 'Tokyo'
63
+ expect(7.working.days.from_now.zone).to eq('JST')
64
+ end
60
65
  end
61
66
 
62
67
  describe '#until' do
@@ -73,6 +78,11 @@ describe WorkingHours::Duration do
73
78
  it "accepts reference time as argument" do
74
79
  expect(7.working.day.until(Time.utc(1991, 11, 15, 21))).to eq(Time.utc(1991, 11, 6, 21))
75
80
  end
81
+
82
+ it 'returns time in config zone' do
83
+ WorkingHours::Config.time_zone = 'Tokyo'
84
+ expect(7.working.days.ago.zone).to eq('JST')
85
+ end
76
86
  end
77
87
 
78
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: working_hours
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Jarthon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-15 00:00:00.000000000 Z
12
+ date: 2014-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport