assistance 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/lib/assistance/validation.rb +2 -2
- data/spec/validation_spec.rb +21 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ include FileUtils
|
|
9
9
|
# Configuration
|
10
10
|
##############################################################################
|
11
11
|
NAME = "assistance"
|
12
|
-
VERS = "0.1.
|
12
|
+
VERS = "0.1.5"
|
13
13
|
CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
|
14
14
|
RDOC_OPTS = [
|
15
15
|
"--quiet",
|
@@ -83,8 +83,8 @@ module Validation
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Delegates method calls to the receiver by calling receiver.validates_xxx.
|
86
|
-
def method_missing(m, *args)
|
87
|
-
@receiver.send(:"validates_#{m}", *args)
|
86
|
+
def method_missing(m, *args, &block)
|
87
|
+
@receiver.send(:"validates_#{m}", *args, &block)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
data/spec/validation_spec.rb
CHANGED
@@ -339,3 +339,24 @@ context "Superclass validations" do
|
|
339
339
|
o.valid?.should be_true
|
340
340
|
end
|
341
341
|
end
|
342
|
+
|
343
|
+
context ".validates with block" do
|
344
|
+
specify "should support calling .each" do
|
345
|
+
@c = Class.new do
|
346
|
+
attr_accessor :vvv
|
347
|
+
|
348
|
+
include Validation
|
349
|
+
validates do
|
350
|
+
each :vvv do |o, a, v|
|
351
|
+
o.errors[a] << "is less than zero" if v.to_i < 0
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
o = @c.new
|
357
|
+
o.vvv = 1
|
358
|
+
o.should be_valid
|
359
|
+
o.vvv = -1
|
360
|
+
o.should_not be_valid
|
361
|
+
end
|
362
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assistance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz, Sam Smoot, Sharon Rosner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-16 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|