validatable 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -73,4 +73,7 @@ Similar to Rails, Validatable also supports conditional validation.
73
73
  end
74
74
  Person.new.valid? #=> true
75
75
 
76
- See the tests for more examples
76
+ See the tests for more examples
77
+
78
+ == Contributors
79
+ Rick Bradley (Revision 25)
@@ -1,11 +1,13 @@
1
1
  module Validatable
2
2
  class ValidatesPresenceOf < ValidationBase #:nodoc:
3
3
  def valid?(instance)
4
- (!instance.send(self.attribute).nil? && instance.send(self.attribute).strip.length != 0)
4
+ return false if instance.send(self.attribute).nil?
5
+ instance.send(self.attribute).respond_to?(:strip) ? instance.send(self.attribute).strip.length != 0 : true
5
6
  end
6
7
 
7
8
  def message
8
9
  super || "can't be empty"
9
10
  end
10
11
  end
11
- end
12
+ end
13
+
@@ -29,7 +29,7 @@ Gem::manage_gems
29
29
  specification = Gem::Specification.new do |s|
30
30
  s.name = "validatable"
31
31
  s.summary = "Validatable is a library for adding validations."
32
- s.version = "1.1.1"
32
+ s.version = "1.1.2"
33
33
  s.author = 'Jay Fields'
34
34
  s.description = "Validatable is a library for adding validations."
35
35
  s.email = 'validatable-developer@rubyforge.org'
@@ -46,6 +46,6 @@ specification = Gem::Specification.new do |s|
46
46
  end
47
47
 
48
48
  Rake::GemPackageTask.new(specification) do |package|
49
- package.need_zip = true
50
- package.need_tar = true
49
+ package.need_zip = false
50
+ package.need_tar = false
51
51
  end
@@ -10,4 +10,10 @@ class ValidatesPresenceOfTest < Test::Unit::TestCase
10
10
  validation = Validatable::ValidatesPresenceOf.new :name
11
11
  assert_equal true, validation.valid?(stub(:name=>"book"))
12
12
  end
13
+
14
+ test "when given a true value which is not a String, then valid is true" do
15
+ validation = Validatable::ValidatesPresenceOf.new :employee
16
+ assert_equal true, validation.valid?(stub(:employee => stub(:nil? => false)))
17
+ end
18
+
13
19
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: validatable
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.1
7
- date: 2007-02-13 00:00:00 -05:00
6
+ version: 1.1.2
7
+ date: 2007-03-25 00:00:00 -04:00
8
8
  summary: Validatable is a library for adding validations.
9
9
  require_paths:
10
10
  - lib
@@ -25,7 +25,6 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
- post_install_message:
29
28
  authors:
30
29
  - Jay Fields
31
30
  files: