cistern 2.2.4 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/cistern/attributes.rb +1 -1
- data/lib/cistern/version.rb +1 -1
- data/spec/model_spec.rb +6 -0
- data/spec/wait_for_spec.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzE1YjIxZjIyMzY5ZWU4NWJmOGFiYTNiMzgwMTIwOWRmM2Q1MzQwZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODliMWIzYWIxNjlhZjg2NzAzNmE0MTgzY2UwNzNkNzgzMDQ5NzgwYQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGI5NjdkNGI5MTUyMWQyNTIzOWUwM2ExMDE4YzI1MDMzYmQ2ZWNlYmI1Mzk3
|
10
|
+
M2I1NGVkMThhNzY3MDAyMTJhNTczMzNlYWZlOWJhMzE5NDQ4ZDk0NjEzNjM5
|
11
|
+
MzA2ODA4ZDIxNzI4NGY3ZGRmNDY3MDJhMzZkM2FiN2Y1YWQ0ZTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YThiNDM3ZDdmYTA5NDFkODkwNDFmZTA2NWRiMTc4MDhmNzU0ZDg3ZmJhYWJh
|
14
|
+
MzM0MDNiMmU4NWU2ZTRmMjA2NDE3Mzg3YzRiZWUxNWM0OWRmMjQwYjM1YWUz
|
15
|
+
M2NkNzEzMDY5MDk1ODU0MzBjODkzMzkxZDNiMDgxNjVmN2Q5NTA=
|
data/lib/cistern/attributes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Cistern::Attributes
|
2
2
|
def self.parsers
|
3
3
|
@parsers ||= {
|
4
|
-
string: ->(v,
|
4
|
+
string: ->(v, opts) { (opts[:allow_nil] && v.nil?) ? v : v.to_s },
|
5
5
|
time: ->(v, _) { v.is_a?(Time) ? v : v && Time.parse(v.to_s) },
|
6
6
|
integer: ->(v, _) { v && v.to_i },
|
7
7
|
float: ->(v, _) { v && v.to_f },
|
data/lib/cistern/version.rb
CHANGED
data/spec/model_spec.rb
CHANGED
@@ -95,6 +95,7 @@ describe 'Cistern::Model' do
|
|
95
95
|
attribute :vegetable, aliases: 'squash'
|
96
96
|
attribute :custom, parser: lambda { |v, _| "X!#{v}" }
|
97
97
|
attribute :default, default: 'im a squash'
|
98
|
+
attribute :string_allow_nil, type: :string, allow_nil: true
|
98
99
|
|
99
100
|
attribute :same_alias_1, aliases: 'nested'
|
100
101
|
attribute :same_alias_2, aliases: 'nested'
|
@@ -111,8 +112,13 @@ describe 'Cistern::Model' do
|
|
111
112
|
|
112
113
|
it 'should parse string' do
|
113
114
|
expect(TypeSpec.new(name: 1).name).to eq('1')
|
115
|
+
expect(TypeSpec.new(name: "b").name).to eq('b')
|
116
|
+
expect(TypeSpec.new(name: nil).name).to eq("")
|
114
117
|
end
|
115
118
|
|
119
|
+
it 'should allow nils in string types' do
|
120
|
+
expect(TypeSpec.new(string_allow_nil: nil).string_allow_nil).to eq(nil)
|
121
|
+
end
|
116
122
|
it "should handle a 'attributes' aliased attribute" do
|
117
123
|
expect(TypeSpec.new(attributes: 'x').adam_attributes).to eq('x')
|
118
124
|
end
|
data/spec/wait_for_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe 'WaitForModel#timeout' do
|
|
45
45
|
|
46
46
|
elapsed = 0
|
47
47
|
|
48
|
-
timeout(2) do
|
48
|
+
Timeout.timeout(2) do
|
49
49
|
expect do
|
50
50
|
model.wait_for! { sleep(0.2); elapsed += 0.2; elapsed > 0.2 }
|
51
51
|
end.to raise_exception(Sample::Timeout)
|
@@ -58,7 +58,7 @@ describe 'WaitForModel#timeout' do
|
|
58
58
|
|
59
59
|
elapsed = 0
|
60
60
|
|
61
|
-
timeout(2) do
|
61
|
+
Timeout.timeout(2) do
|
62
62
|
expect do
|
63
63
|
model.wait_for!(0.1) { sleep(0.2); elapsed += 0.2; elapsed > 0.2 }
|
64
64
|
end.to raise_exception(Sample::Timeout)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cistern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: API client framework extracted from Fog
|
14
14
|
email:
|
@@ -17,9 +17,9 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
20
|
+
- .gemrelease
|
21
|
+
- .gitignore
|
22
|
+
- .travis.yml
|
23
23
|
- CHANGELOG.md
|
24
24
|
- Gemfile
|
25
25
|
- Guardfile
|
@@ -73,17 +73,17 @@ require_paths:
|
|
73
73
|
- lib
|
74
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ! '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.5.1
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: API client framework
|