durran-validatable 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
2
  :minor: 8
3
- :patch: 2
3
+ :patch: 3
4
4
  :major: 1
5
+ :build:
@@ -1,16 +1,16 @@
1
- module Validatable
1
+ module Validatable
2
2
  class ValidatesPresenceOf < ValidationBase #:nodoc:
3
3
  def valid?(instance)
4
4
  value = instance.send(self.attribute)
5
5
  return true if allow_nil && value.nil?
6
6
  return true if allow_blank && value.blank?
7
-
7
+
8
8
  return false if instance.send(self.attribute).nil?
9
9
  value.respond_to?(:strip) ? instance.send(self.attribute).strip.length != 0 : true
10
10
  end
11
-
11
+
12
12
  def message(instance)
13
- super || "can't be empty"
13
+ super || "can't be blank"
14
14
  end
15
15
  end
16
16
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  functional_tests do
4
4
 
5
- expect "can't be empty" do
5
+ expect "can't be blank" do
6
6
  child_class = Module.new do
7
7
  include Validatable
8
8
  validates_presence_of :name
@@ -20,7 +20,7 @@ functional_tests do
20
20
  instance.errors.on(:name)
21
21
  end
22
22
 
23
- expect "can't be empty" do
23
+ expect "can't be blank" do
24
24
  child_class = Module.new do
25
25
  include Validatable
26
26
  validates_presence_of :name
@@ -139,7 +139,7 @@ functional_tests do
139
139
  instance.errors.on(:address)
140
140
  end
141
141
 
142
- expect "can't be empty" do
142
+ expect "can't be blank" do
143
143
  child_class = Class.new do
144
144
  include Validatable
145
145
  attr_accessor :name, :address
@@ -178,7 +178,7 @@ functional_tests do
178
178
  end
179
179
  instance = klass.new
180
180
  instance.valid?
181
- assert_equal "can't be empty", instance.errors.on(:name)
181
+ assert_equal "can't be blank", instance.errors.on(:name)
182
182
  end
183
183
 
184
184
  test "when child validations have errors, level 1 parent validations are still performed" do
@@ -199,11 +199,11 @@ functional_tests do
199
199
  end
200
200
  instance = klass.new
201
201
  instance.valid?
202
- assert_equal "can't be empty", instance.errors.on(:name)
202
+ assert_equal "can't be blank", instance.errors.on(:name)
203
203
  assert_equal "invalid message", instance.errors.on(:address)
204
204
  end
205
205
 
206
- expect "can't be empty" do
206
+ expect "can't be blank" do
207
207
  child_class = Class.new do
208
208
  include Validatable
209
209
  attr_accessor :name, :address
@@ -221,7 +221,7 @@ functional_tests do
221
221
  instance.errors.on(:namen)
222
222
  end
223
223
 
224
- expect "can't be empty" do
224
+ expect "can't be blank" do
225
225
  child_class = Class.new do
226
226
  include Validatable
227
227
  attr_accessor :name, :address
@@ -271,7 +271,7 @@ functional_tests do
271
271
  assert instance.valid?
272
272
  instance.name_required = true
273
273
  assert !instance.valid?
274
- assert_equal "can't be empty", instance.errors.on(:name)
274
+ assert_equal "can't be blank", instance.errors.on(:name)
275
275
  end
276
276
 
277
277
  test ':if with string should work' do
@@ -289,7 +289,7 @@ functional_tests do
289
289
  assert instance.valid?
290
290
  instance.name_required = true
291
291
  assert !instance.valid?
292
- assert_equal "can't be empty", instance.errors.on(:name)
292
+ assert_equal "can't be blank", instance.errors.on(:name)
293
293
  end
294
294
 
295
295
  test "classes only have valid_for_* methods for groups that appear in their validations" do
@@ -318,7 +318,7 @@ functional_tests do
318
318
  assert_equal nil, instance.errors.on(:name)
319
319
  end
320
320
 
321
- expect "can't be empty twice changed message" do
321
+ expect "can't be blank twice changed message" do
322
322
  klass = Class.new do
323
323
  include Validatable
324
324
  validates_presence_of :name
@@ -449,7 +449,7 @@ functional_tests do
449
449
  klass.validations.first.key
450
450
  end
451
451
 
452
- expect "can't be empty" do
452
+ expect "can't be blank" do
453
453
  klass = Class.new do
454
454
  include Validatable
455
455
  validates_presence_of :name, :address
@@ -10,7 +10,7 @@ module Functional
10
10
  end
11
11
  instance = klass.new
12
12
  instance.valid?
13
- assert_equal "can't be empty", instance.errors.on(:name)
13
+ assert_equal "can't be blank", instance.errors.on(:name)
14
14
  end
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durran-validatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Fields
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-10-31 00:00:00 -04:00
14
+ date: 2009-11-28 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies: []
17
17