auto_validations 0.0.1 → 0.0.2

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.
@@ -8,7 +8,7 @@ module AutoValidations
8
8
  module ClassMethods
9
9
  def auto_length_validation
10
10
  columns.each do |column|
11
- validates_length_of column.name, :maximum => column.limit if column.limit
11
+ validates_length_of column.name, :maximum => column.limit, :allow_blank => true if column.limit
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module AutoValidations
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -38,3 +38,14 @@ class BelowLengthValidationsTest < Test::Unit::TestCase
38
38
  assert @android.valid?
39
39
  end
40
40
  end
41
+
42
+ class AllowBlankTest < Test::Unit::TestCase
43
+ def setup
44
+ Android.auto_length_validation
45
+ @android = Android.new :name => nil
46
+ end
47
+
48
+ def test_should_not_throw_errors
49
+ assert_nothing_thrown { @android.valid? }
50
+ end
51
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_validations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rodrigo Navarro