version-one 0.0.8 → 0.0.9

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.
@@ -386,12 +386,10 @@ end
386
386
  add_generic_attribute(a, opts) do |attr_name, options|
387
387
  script = %{
388
388
  val = case val
389
- when NilClass
390
- val
391
389
  }
392
390
  if options[:multivalue]
393
391
  script << %{
394
- when Asset, AssetRef, Array
392
+ when Asset, AssetRef, Array, NilClass
395
393
  rel = @attributes['#{attr_name}'] || RelationMultiValue.new
396
394
  rel.set(val)
397
395
  else
@@ -400,6 +398,8 @@ end
400
398
  }
401
399
  else
402
400
  script << %{
401
+ when NilClass
402
+ val
403
403
  when Array
404
404
  raise ArgumentError.new("Too many values for single value attribute") if val.size > 1
405
405
  val[0]
@@ -1,3 +1,3 @@
1
1
  module VersionOne
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -54,6 +54,19 @@ describe VersionOne::Asset do
54
54
  it 'should provide attribute readers for queried attributes' do
55
55
  expect(subject).to respond_to :security_scope_name
56
56
  end
57
+
58
+ it 'should set empty single relations to nil' do
59
+ expect(subject.team).to be_nil
60
+ end
61
+
62
+ it 'should set empty multiple relations to an empty RelationMultiValue' do
63
+ expect(subject.owners).to be_a VersionOne::RelationMultiValue
64
+ expect(subject.owners).to be_empty
65
+ end
66
+
67
+ it 'should set empty simple values to nil' do
68
+ expect(subject.original_estimate).to be_nil
69
+ end
57
70
  end
58
71
 
59
72
  context 'with multiple results' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version-one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-03 00:00:00.000000000 Z
12
+ date: 2014-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby