bound 2.1.2 → 2.2.0

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: d367e429144814a0db70aaea12761df7b1479a89
4
- data.tar.gz: 199e6c7b1219694b20fa1dfcdb2b2a561a96647a
3
+ metadata.gz: 1e611bbeb3b6f8b649efc18a6ef08e37acf5f088
4
+ data.tar.gz: ed887777475b4e99ece4bc304c1c95478ef4060b
5
5
  SHA512:
6
- metadata.gz: 50b4214d6419e07f9f6f082a1329d00618267121518602aa91bf83cf8df98da43a80a4e9d9d3e5b351e1ac8fd387ce4bf70a4ae728bfaaa078068b5e1103e94a
7
- data.tar.gz: 94bff9a1f241cf4b17aa617796e4d9d045af20c2fb72be9c8a19ccd1532e3bd6666564cdeda71798b58efd360b8652bce2d036f5f82e64a7b24bb6986f837646
6
+ metadata.gz: 04725dd9df62aa9ae9a4044831ed2edf41c77c6e7249377f9ecc2441085f5492ff7e3ff89bf77589d903c42dc271604229301bf95af43452b7d0d832fa9c1c8e
7
+ data.tar.gz: cb08fd0d64f330182f3b964445b237cccd759d27bc6c792b8791c33a3a53be82e7cd34082cac5038331b996bc9be8dfcae7ea6af7d441de49fe333c1ed051c39
data/README.md CHANGED
@@ -150,3 +150,12 @@ Because of legacy software we also support some older versions:
150
150
  3. Commit your changes (`git commit -am 'Add some feature'`)
151
151
  4. Push to the branch (`git push origin my-new-feature`)
152
152
  5. Create new Pull Request
153
+
154
+ ## Release
155
+
156
+ ```
157
+ # Bump version
158
+ edit lib/bound/version.rb
159
+ git commit -am "Bump to version X.Y.Z"
160
+ rake release
161
+ ```
@@ -1,5 +1,6 @@
1
1
  require "bound/version"
2
2
  require "bound/caller"
3
+ require "bound/errors"
3
4
 
4
5
  class Bound
5
6
  def self.new(*args)
@@ -58,7 +59,7 @@ class Bound
58
59
  a.each do |attr|
59
60
  unless b.include? attr
60
61
  message = "Unknown attribute: #{attr.inspect} in #{b}"
61
- raise ArgumentError, message
62
+ raise UnknownAttributeError, message
62
63
  end
63
64
  end
64
65
  end
@@ -66,7 +67,7 @@ class Bound
66
67
  def ensure_present!(attribute)
67
68
  if !overwritten?(attribute) && !target_has?(attribute)
68
69
  message = "Missing attribute: #{attribute}"
69
- raise ArgumentError, message
70
+ raise MissingAttributeError, message
70
71
  end
71
72
  end
72
73
 
@@ -0,0 +1,5 @@
1
+ class MissingAttributeError < ArgumentError
2
+ end
3
+
4
+ class UnknownAttributeError < ArgumentError
5
+ end
@@ -1,3 +1,3 @@
1
1
  class Bound
2
- VERSION = "2.1.2"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -29,7 +29,7 @@ describe Bound do
29
29
  the_hash.delete :age
30
30
 
31
31
  [the_hash, object].each do |subject|
32
- exception = assert_raises ArgumentError, subject.inspect do
32
+ exception = assert_raises MissingAttributeError, subject.inspect do
33
33
  User.new(subject)
34
34
  end
35
35
 
@@ -49,7 +49,7 @@ describe Bound do
49
49
  the_hash[:gender] = "M"
50
50
  subject = the_hash
51
51
 
52
- exception = assert_raises ArgumentError, subject.inspect do
52
+ exception = assert_raises UnknownAttributeError, subject.inspect do
53
53
  User.new(subject)
54
54
  end
55
55
 
@@ -172,7 +172,7 @@ describe Bound do
172
172
  it 'fails if argument of optional nested bound is missing' do
173
173
  the_hash[:profile].delete(:age)
174
174
  [the_hash, object].each do |subject|
175
- error = assert_raises ArgumentError do
175
+ error = assert_raises MissingAttributeError do
176
176
  UserWithProfile.new(subject)
177
177
  end
178
178
  assert_match(/missing/i, error.message)
@@ -213,7 +213,7 @@ describe Bound do
213
213
  it 'fails if nested attributes are missing' do
214
214
  the_hash[:company].delete(:name)
215
215
  [the_hash, object].each do |subject|
216
- error = assert_raises ArgumentError do
216
+ error = assert_raises MissingAttributeError do
217
217
  EmployedUser.new(subject)
218
218
  end
219
219
  assert_match(/missing/i, error.message)
@@ -257,7 +257,7 @@ describe Bound do
257
257
  it 'fails if nested bound is missing an attribute' do
258
258
  the_hash[:posts][1].delete(:title)
259
259
  [the_hash, object].each do |subject|
260
- error = assert_raises ArgumentError do
260
+ error = assert_raises MissingAttributeError do
261
261
  BloggingUser.new(subject)
262
262
  end
263
263
  assert_match(/missing/i, error.message)
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: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Holderbaum
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-22 00:00:00.000000000 Z
12
+ date: 2017-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - bound.gemspec
86
86
  - lib/bound.rb
87
87
  - lib/bound/caller.rb
88
+ - lib/bound/errors.rb
88
89
  - lib/bound/version.rb
89
90
  - spec/bound_spec.rb
90
91
  - spec/caller_spec.rb