working_hours 1.1.3 → 1.1.4
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 +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/working_hours/config.rb +1 -1
- data/lib/working_hours/version.rb +1 -1
- data/spec/working_hours/config_spec.rb +41 -8
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f00a9f2b6cd9d293631464feb64a41d6c738b03f
|
|
4
|
+
data.tar.gz: c18fa540c8033e1d8c1f42cad501420f16c6c7d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb32d4257bb17d0c0dc5d7595e19f808ec76970d38bb46ab3b4bf0893ed3d05e9f1734db7f49ec09a89eb495bc21e45a98bd08ce40979edd89efbbfd039f8539
|
|
7
|
+
data.tar.gz: f9874b5d95e6b47846d194347de5e78c14fe56d95a36071a1215e016dfe9312c3a57f0343aabdb4a4280fc89900e100e5c5598975954683d32a08cb18cfd92bd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
-
[Compare master with v1.1.
|
|
3
|
+
[Compare master with v1.1.4](https://github.com/intrepidd/working_hours/compare/v1.1.4...master)
|
|
4
|
+
|
|
5
|
+
# v1.1.4
|
|
6
|
+
* Fix thread safety - [#36](https://github.com/Intrepidd/working_hours/pull/36)
|
|
4
7
|
|
|
5
8
|
# v1.1.3
|
|
6
9
|
* Fixed warnings with Ruby 2.4.0+ - [#32](https://github.com/Intrepidd/working_hours/pull/32)
|
data/lib/working_hours/config.rb
CHANGED
|
@@ -5,25 +5,58 @@ describe WorkingHours::Config do
|
|
|
5
5
|
describe '.working_hours' do
|
|
6
6
|
|
|
7
7
|
let(:config) { WorkingHours::Config.working_hours }
|
|
8
|
+
let(:config2) { { :mon => { '08:00' => '14:00' } } }
|
|
9
|
+
let(:config3) { { :tue => { '10:00' => '16:00' } } }
|
|
8
10
|
|
|
9
11
|
it 'has a default config' do
|
|
10
12
|
expect(config).to be_kind_of(Hash)
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
it 'is thread safe' do
|
|
16
|
+
expect(WorkingHours::Config.working_hours).to eq(config)
|
|
17
|
+
|
|
18
|
+
thread = Thread.new do
|
|
19
|
+
WorkingHours::Config.working_hours = config2
|
|
20
|
+
expect(WorkingHours::Config.working_hours).to eq(config2)
|
|
21
|
+
Thread.stop
|
|
22
|
+
expect(WorkingHours::Config.working_hours).to eq(config2)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
expect {
|
|
26
|
+
sleep 0.1 # let the thread begin its execution
|
|
27
|
+
}.not_to change { WorkingHours::Config.working_hours }.from(config)
|
|
28
|
+
|
|
29
|
+
expect {
|
|
30
|
+
WorkingHours::Config.working_hours = config3
|
|
31
|
+
}.to change { WorkingHours::Config.working_hours }.from(config).to(config3)
|
|
32
|
+
|
|
14
33
|
expect {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}.not_to change { WorkingHours::Config.working_hours }
|
|
34
|
+
thread.run
|
|
35
|
+
thread.join
|
|
36
|
+
}.not_to change { WorkingHours::Config.working_hours }.from(config3)
|
|
19
37
|
end
|
|
20
38
|
|
|
21
39
|
it 'is fiber safe' do
|
|
40
|
+
expect(WorkingHours::Config.working_hours).to eq(config)
|
|
41
|
+
|
|
42
|
+
fiber = Fiber.new do
|
|
43
|
+
WorkingHours::Config.working_hours = config2
|
|
44
|
+
expect(WorkingHours::Config.working_hours).to eq(config2)
|
|
45
|
+
Fiber.yield
|
|
46
|
+
expect(WorkingHours::Config.working_hours).to eq(config2)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
expect {
|
|
50
|
+
fiber.resume
|
|
51
|
+
}.not_to change { WorkingHours::Config.working_hours }.from(config)
|
|
52
|
+
|
|
53
|
+
expect {
|
|
54
|
+
WorkingHours::Config.working_hours = config3
|
|
55
|
+
}.to change { WorkingHours::Config.working_hours }.from(config).to(config3)
|
|
56
|
+
|
|
22
57
|
expect {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}.resume
|
|
26
|
-
}.not_to change { WorkingHours::Config.working_hours }
|
|
58
|
+
fiber.resume
|
|
59
|
+
}.not_to change { WorkingHours::Config.working_hours }.from(config3)
|
|
27
60
|
end
|
|
28
61
|
|
|
29
62
|
it 'is initialized from last known global config' do
|
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.1.
|
|
4
|
+
version: 1.1.4
|
|
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:
|
|
12
|
+
date: 2018-11-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
154
|
version: '0'
|
|
155
155
|
requirements: []
|
|
156
156
|
rubyforge_project:
|
|
157
|
-
rubygems_version: 2.
|
|
157
|
+
rubygems_version: 2.5.1
|
|
158
158
|
signing_key:
|
|
159
159
|
specification_version: 4
|
|
160
160
|
summary: time calculation with working hours
|
|
@@ -167,3 +167,4 @@ test_files:
|
|
|
167
167
|
- spec/working_hours/duration_proxy_spec.rb
|
|
168
168
|
- spec/working_hours/duration_spec.rb
|
|
169
169
|
- spec/working_hours_spec.rb
|
|
170
|
+
has_rdoc:
|