dm-validations 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'pathname'
3
3
 
4
- gem 'dm-core', '=0.9.4'
4
+ gem 'dm-core', '=0.9.5'
5
5
  require 'dm-core'
6
6
 
7
7
  dir = Pathname(__FILE__).dirname.expand_path / 'dm-validations'
@@ -87,6 +87,7 @@ module DataMapper
87
87
  end
88
88
 
89
89
  def ==(other)
90
+ self.class == other.class &&
90
91
  self.field_name == other.field_name &&
91
92
  self.if_clause == other.if_clause &&
92
93
  self.unless_clause == other.unless_clause &&
@@ -15,7 +15,7 @@ module DataMapper
15
15
  def call(target)
16
16
  value = target.validation_property_value(@field_name)
17
17
  property = target.validation_property(@field_name)
18
- return true if value.nil? || value.kind_of?(property.primitive)
18
+ return true if value.nil? || value.kind_of?(property.primitive) || property.primitive == TrueClass && value.kind_of?(FalseClass)
19
19
 
20
20
  error_message = @options[:message] || default_error(property)
21
21
  add_error(target, error_message, @field_name)
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module Validations
3
- VERSION = "0.9.4"
3
+ VERSION = "0.9.5"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ class Monica # :nodoc:
5
5
  include DataMapper::Resource
6
6
  property :id, Integer, :serial => true
7
7
  property :birth_date, Date, :auto_validation => false
8
+ property :happy, TrueClass
8
9
  validates_is_primitive :birth_date
9
10
  end
10
11
 
@@ -22,4 +23,9 @@ describe DataMapper::Validate::PrimitiveValidator do
22
23
  b.should be_valid
23
24
  b.birth_date.should eql(Date.civil(2008,1,1))
24
25
  end
26
+ it "should accept FalseClass even when the property type is TrueClass" do
27
+ b = Monica.new
28
+ b.happy = false
29
+ b.valid?.should == true
30
+ end
25
31
  end
@@ -9,7 +9,7 @@ def load_driver(name, default_uri)
9
9
  lib = "do_#{name}"
10
10
 
11
11
  begin
12
- gem lib, '=0.9.4'
12
+ gem lib, '=0.9.5'
13
13
  require lib
14
14
  DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
15
15
  DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy van den Berg
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-21 00:00:00 -05:00
12
+ date: 2008-08-26 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.4
23
+ version: 0.9.5
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe