Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdul-Rahman Advany committed May 27, 2008
2 parents 689cac2 + dad4c9f commit 19782c1
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module DataMapper
# Set this to the version of dm-core that you are building against/for
VERSION = "0.9.0"
VERSION = "0.9.0.1"

# Set this to the version of dm-more you plan to release
MORE_VERSION = "0.9.0"
MORE_VERSION = "0.9.0.1"
end

require 'pathname'
Expand Down
2 changes: 1 addition & 1 deletion adapters/dm-couchdb-adapter/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-couchdb-adapter'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-aggregates/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-aggregates'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-ar-finders/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-ar-finders'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-cli/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-cli'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-is-nested_set/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-is-nested_set'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-is-tree/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-is-tree'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-migrations/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-migrations'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-serializer/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-serializer'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-timestamps/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-timestamps'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-types/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLEAN.include '{log,pkg}/'

spec = Gem::Specification.new do |s|
s.name = 'dm-types'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
2 changes: 1 addition & 1 deletion dm-validations/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end

spec = Gem::Specification.new do |s|
s.name = 'dm-validations'
s.version = '0.9.0'
s.version = '0.9.0.1'
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = %w[ README LICENSE TODO ]
Expand Down
8 changes: 4 additions & 4 deletions dm-validations/lib/dm-validations/numeric_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def call(target)
else
if scale && precision
if scale == precision
return true if value =~ /\A(?:0\.\d{1,#{precision}})\z/
return true if value =~ /\A[+-]?(?:0\.\d{1,#{precision}})\z/
elsif precision == 0
return true if value =~ /\A(?:\d{1,#{scale}}(?:\.0)?)\z/
return true if value =~ /\A[+-]?(?:\d{1,#{scale}}(?:\.0)?)\z/
else
return true if value =~ /\A(?:\d{1,#{scale - precision}}|\d{0,#{scale - precision}}\.\d{1,#{precision}})\z/
return true if value =~ /\A[+-]?(?:\d{1,#{scale - precision}}|\d{0,#{scale - precision}}\.\d{1,#{precision}})\z/
end
else
return true if value =~ /\A(?:\d+|\d*\.\d+)\z/
return true if value =~ /\A[+-]?(?:\d+|\d*\.\d+)\z/
end
error_message ||= '%s must be a number'.t(DataMapper::Inflection.humanize(@field_name))
end
Expand Down
24 changes: 24 additions & 0 deletions dm-validations/spec/integration/numeric_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,28 @@ class GoldFish < Fish
@gold_fish.average_weight = 99
@gold_fish.should be_valid

@gold_fish.average_weight = -99
@gold_fish.should be_valid

@gold_fish.average_weight = 100
@gold_fish.should_not be_valid

@gold_fish.average_weight = -100
@gold_fish.should_not be_valid
end

it 'should allow 2 digits of precision after the decimal' do
@gold_fish.average_weight = 99.99
@gold_fish.should be_valid

@gold_fish.average_weight = -99.99
@gold_fish.should be_valid

@gold_fish.average_weight = 99.999
@gold_fish.should_not be_valid

@gold_fish.average_weight = -99.999
@gold_fish.should_not be_valid
end
end

Expand All @@ -151,16 +163,28 @@ class SilverFish < Fish
@silver_fish.average_weight = 0.1
@silver_fish.should be_valid

@silver_fish.average_weight = -0.1
@silver_fish.should be_valid

@silver_fish.average_weight = 1
@silver_fish.should_not be_valid

@silver_fish.average_weight = -1
@silver_fish.should_not be_valid
end

it 'should allow 2 digits of precision after the decimal' do
@silver_fish.average_weight = 0.99
@silver_fish.should be_valid

@silver_fish.average_weight = -0.99
@silver_fish.should be_valid

@silver_fish.average_weight = 0.999
@silver_fish.should_not be_valid

@silver_fish.average_weight = -0.999
@silver_fish.should_not be_valid
end
end
end
Expand Down

0 comments on commit 19782c1

Please sign in to comment.