cistern 2.2.4 → 2.2.5

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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 12f0361fa92430b5aab7d1b3e8934a615670369a
4
- data.tar.gz: 0a09ee7dd69399efbeb59a6341cbf6b18d7e55af
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzE1YjIxZjIyMzY5ZWU4NWJmOGFiYTNiMzgwMTIwOWRmM2Q1MzQwZg==
5
+ data.tar.gz: !binary |-
6
+ ODliMWIzYWIxNjlhZjg2NzAzNmE0MTgzY2UwNzNkNzgzMDQ5NzgwYQ==
5
7
  SHA512:
6
- metadata.gz: 03c0726e4050c3c02fa05397625a43b651516dc1d7eea53166953dad89286212474ec880d74411ca44ff1d511c8cf17809116dc695831c118a02fe01fa3d4f01
7
- data.tar.gz: d5149e6a0212522f9dae85f85b73ba1e699da5a06093a48b1ee5c5aa8733c43ee5855409c57c57ea6d24e940435b487c377eb7d0cb6d875d53fb999eea967c7f
8
+ metadata.gz: !binary |-
9
+ NGI5NjdkNGI5MTUyMWQyNTIzOWUwM2ExMDE4YzI1MDMzYmQ2ZWNlYmI1Mzk3
10
+ M2I1NGVkMThhNzY3MDAyMTJhNTczMzNlYWZlOWJhMzE5NDQ4ZDk0NjEzNjM5
11
+ MzA2ODA4ZDIxNzI4NGY3ZGRmNDY3MDJhMzZkM2FiN2Y1YWQ0ZTQ=
12
+ data.tar.gz: !binary |-
13
+ YThiNDM3ZDdmYTA5NDFkODkwNDFmZTA2NWRiMTc4MDhmNzU0ZDg3ZmJhYWJh
14
+ MzM0MDNiMmU4NWU2ZTRmMjA2NDE3Mzg3YzRiZWUxNWM0OWRmMjQwYjM1YWUz
15
+ M2NkNzEzMDY5MDk1ODU0MzBjODkzMzkxZDNiMDgxNjVmN2Q5NTA=
@@ -1,7 +1,7 @@
1
1
  module Cistern::Attributes
2
2
  def self.parsers
3
3
  @parsers ||= {
4
- string: ->(v, _) { v.to_s },
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 },
@@ -1,3 +1,3 @@
1
1
  module Cistern
2
- VERSION = '2.2.4'
2
+ VERSION = '2.2.5'
3
3
  end
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
@@ -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
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: 2015-11-27 00:00:00.000000000 Z
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
- - ".gemrelease"
21
- - ".gitignore"
22
- - ".travis.yml"
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.4.5.1
86
+ rubygems_version: 2.5.1
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: API client framework