bound 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc68645b9e6959ecd3ece462ec5dee9ad156f4b9
4
- data.tar.gz: 33b710637f5f69d3641b0a0db647de2b9ac5588b
3
+ metadata.gz: d49b1e7d8ae733c85d4adc9745275673ee409ff6
4
+ data.tar.gz: 16d268a92eda75a87f4cc0e144866aed12eed7d6
5
5
  SHA512:
6
- metadata.gz: 4abcc5efccc8d0ef8a0f34240e175b344b4fd363b7e78b886bba5f6347d9061607d1bc79533eddd00580c8d8b280fb2ca37f55823c542eb4bd3c0953e5049205
7
- data.tar.gz: 23c47fd4ed1031cc045059c51c3e8c59153cbda8b77aec962860dd01c7ef90982e84fa6c42b82ecd3079576ebfc0a1b168f9d781bb890901118ed5bd223db03d
6
+ metadata.gz: af6cb0fee682b4e6a1b0245d4e8da571e05585c1d2b14f6a4c61c161a186a4a099d8aa0497ca86a5141aca35d3e58da6a8d09b6a8b611500e2c356c22821ef0b
7
+ data.tar.gz: 048b801aeae0fd2bc5b99ef9225bbdaef12f8510f3ca37828aebb358944ce0e9a9bed7cf5f58921aa8cc44fb7e283043184d3e092fd30a05a7d2ac318de23177
data/lib/bound.rb CHANGED
@@ -32,6 +32,10 @@ class Bound
32
32
  end
33
33
 
34
34
  def set_attributes(*attributes)
35
+ if attributes.any? { |a| !a.kind_of? Symbol }
36
+ raise ArgumentError.new("Invalid list of attributes: #{attributes.inspect}")
37
+ end
38
+
35
39
  self.attributes += attributes
36
40
  attr_accessor *attributes
37
41
 
@@ -39,6 +43,10 @@ class Bound
39
43
  end
40
44
 
41
45
  def optional(*optionals)
46
+ if optionals.any? { |a| !a.kind_of? Symbol }
47
+ raise ArgumentError.new("Invalid list of optional attributes: #{optionals.inspect}")
48
+ end
49
+
42
50
  self.optional_attributes += optionals
43
51
  attr_accessor *optionals
44
52
 
data/lib/bound/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Bound
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/spec/bound_spec.rb CHANGED
@@ -55,6 +55,20 @@ describe Bound do
55
55
  assert_match(/unknown.+gender/i, exception.message)
56
56
  end
57
57
 
58
+ describe 'wrong initialization' do
59
+ it 'fails if new is not called with symbols' do
60
+ assert_raises ArgumentError do
61
+ Bound.new(:events => [])
62
+ end
63
+ end
64
+
65
+ it 'fails if optional is not called with symbols' do
66
+ assert_raises ArgumentError do
67
+ Bound.new.optional(:events => [])
68
+ end
69
+ end
70
+ end
71
+
58
72
  describe 'inspect' do
59
73
  let(:inspection) { user.inspect }
60
74
  let(:user) { User.build(hash) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Holderbaum