mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 23:33:00 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
360108c39f | ||
|
|
0ad8ace335 | ||
|
|
7c9ec695f4 | ||
|
|
6af61917dd | ||
|
|
43e6748cd2 | ||
|
|
760a52a2a4 | ||
|
|
9f1642c730 | ||
|
|
011ea070db | ||
|
|
b632093ce2 | ||
|
|
525b3b9941 |
@@ -1,3 +1,11 @@
|
|||||||
|
= 1.1.3 [2009-01-13]
|
||||||
|
- Fixed bug where time and date attributes still being parsed on read using Rails default parser [reported by Brad (pvjq)]
|
||||||
|
|
||||||
|
= 1.1.2 [2009-01-12]
|
||||||
|
- Fixed bugs
|
||||||
|
- matcher failing for custom error message without interpolation keys using I18n
|
||||||
|
- validator custom error messages not being extracted
|
||||||
|
|
||||||
= 1.1.1 [2009-01-03]
|
= 1.1.1 [2009-01-03]
|
||||||
- Fixed bug in matcher for options local variable
|
- Fixed bug in matcher for options local variable
|
||||||
|
|
||||||
|
|||||||
2
Rakefile
2
Rakefile
@@ -5,7 +5,7 @@ require 'date'
|
|||||||
require 'spec/rake/spectask'
|
require 'spec/rake/spectask'
|
||||||
|
|
||||||
GEM = "validates_timeliness"
|
GEM = "validates_timeliness"
|
||||||
GEM_VERSION = "1.1.1"
|
GEM_VERSION = "1.1.3"
|
||||||
AUTHOR = "Adam Meehan"
|
AUTHOR = "Adam Meehan"
|
||||||
EMAIL = "adam.meehan@gmail.com"
|
EMAIL = "adam.meehan@gmail.com"
|
||||||
HOMEPAGE = "http://github.com/adzap/validates_timeliness"
|
HOMEPAGE = "http://github.com/adzap/validates_timeliness"
|
||||||
|
|||||||
6
TODO
6
TODO
@@ -1,7 +1,5 @@
|
|||||||
- :format option
|
- :format option
|
||||||
- :with_date and :with_time options
|
- :with_date and :with_time options
|
||||||
- Merb and Data Mapper support
|
|
||||||
- does it have before_type_cast
|
|
||||||
- timezone handling
|
|
||||||
- view helper support
|
|
||||||
- valid formats could come from locale file
|
- valid formats could come from locale file
|
||||||
|
- formats to use month and day names from i18n
|
||||||
|
- add replace_formats instead add_formats :before
|
||||||
|
|||||||
@@ -14,24 +14,10 @@ module ValidatesTimeliness
|
|||||||
# will not be in the attribute cache on first read so will be considered in default
|
# will not be in the attribute cache on first read so will be considered in default
|
||||||
# timezone and converted to local time. It is then stored back in the attributes
|
# timezone and converted to local time. It is then stored back in the attributes
|
||||||
# hash and cached to avoid the need for any subsequent differentiation.
|
# hash and cached to avoid the need for any subsequent differentiation.
|
||||||
#
|
|
||||||
# The wholesale replacement of the Rails time type casting is not done to
|
|
||||||
# preserve the quickest conversion for timestamp columns and also any value
|
|
||||||
# which is never changed during the life of the record object.
|
|
||||||
module AttributeMethods
|
module AttributeMethods
|
||||||
|
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend ClassMethods
|
base.extend ClassMethods
|
||||||
|
|
||||||
if Rails::VERSION::STRING < '2.1'
|
|
||||||
base.class_eval do
|
|
||||||
class << self
|
|
||||||
def create_time_zone_conversion_attribute?(name, column)
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds check for cached date/time attributes which have been type cast already
|
# Adds check for cached date/time attributes which have been type cast already
|
||||||
@@ -57,25 +43,19 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Writes attribute value by storing raw value in attributes hash,
|
|
||||||
# then convert it with parser and cache it.
|
|
||||||
#
|
|
||||||
# If Rails dirty attributes is enabled then the value is added to
|
# If Rails dirty attributes is enabled then the value is added to
|
||||||
# changed attributes if changed. Can't use the default dirty checking
|
# changed attributes if changed. Can't use the default dirty checking
|
||||||
# implementation as it chains the write_attribute method which deletes
|
# implementation as it chains the write_attribute method which deletes
|
||||||
# the attribute from the cache.
|
# the attribute from the cache.
|
||||||
def write_date_time_attribute(attr_name, value)
|
def write_date_time_attribute(attr_name, value, type, time_zone_aware)
|
||||||
column = column_for_attribute(attr_name)
|
|
||||||
old = read_attribute(attr_name) if defined?(::ActiveRecord::Dirty)
|
old = read_attribute(attr_name) if defined?(::ActiveRecord::Dirty)
|
||||||
new = self.class.parse_date_time(value, column.type)
|
new = self.class.parse_date_time(value, type)
|
||||||
|
|
||||||
unless column.type == :date || new.nil?
|
unless type == :date || new.nil?
|
||||||
new = new.to_time rescue new
|
new = new.to_time rescue new
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.class.send(:create_time_zone_conversion_attribute?, attr_name, column)
|
new = new.in_time_zone if new && time_zone_aware
|
||||||
new = new.in_time_zone rescue nil
|
|
||||||
end
|
|
||||||
@attributes_cache[attr_name] = new
|
@attributes_cache[attr_name] = new
|
||||||
|
|
||||||
if defined?(::ActiveRecord::Dirty) && !changed_attributes.include?(attr_name) && old != new
|
if defined?(::ActiveRecord::Dirty) && !changed_attributes.include?(attr_name) && old != new
|
||||||
@@ -84,6 +64,24 @@ module ValidatesTimeliness
|
|||||||
@attributes[attr_name] = value
|
@attributes[attr_name] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If reloading then check if cached, which means its in local time.
|
||||||
|
# If local, convert with parser as local timezone, otherwise use
|
||||||
|
# read_attribute method for quick default type cast of values from
|
||||||
|
# database using default timezone.
|
||||||
|
def read_date_time_attribute(attr_name, type, time_zone_aware, reload = false)
|
||||||
|
cached = @attributes_cache[attr_name]
|
||||||
|
return cached if @attributes_cache.has_key?(attr_name) && !reload
|
||||||
|
|
||||||
|
if @attributes_cache.has_key?(attr_name)
|
||||||
|
time = read_attribute_before_type_cast(attr_name)
|
||||||
|
time = self.class.parse_date_time(date, type)
|
||||||
|
else
|
||||||
|
time = read_attribute(attr_name)
|
||||||
|
@attributes[attr_name] = time && time_zone_aware ? time.in_time_zone : time
|
||||||
|
end
|
||||||
|
@attributes_cache[attr_name] = time && time_zone_aware ? time.in_time_zone : time
|
||||||
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
||||||
# Override AR method to define attribute reader and writer method for
|
# Override AR method to define attribute reader and writer method for
|
||||||
@@ -94,8 +92,9 @@ module ValidatesTimeliness
|
|||||||
unless instance_method_already_implemented?(name)
|
unless instance_method_already_implemented?(name)
|
||||||
if self.serialized_attributes[name]
|
if self.serialized_attributes[name]
|
||||||
define_read_method_for_serialized_attribute(name)
|
define_read_method_for_serialized_attribute(name)
|
||||||
elsif create_time_zone_conversion_attribute?(name, column)
|
elsif [:date, :time, :datetime].include?(column.type)
|
||||||
define_read_method_for_time_zone_conversion(name)
|
time_zone_aware = create_time_zone_conversion_attribute?(name, column) rescue false
|
||||||
|
define_read_method_for_dates_and_times(name, column.type, time_zone_aware)
|
||||||
else
|
else
|
||||||
define_read_method(name.to_sym, name, column)
|
define_read_method(name.to_sym, name, column)
|
||||||
end
|
end
|
||||||
@@ -103,7 +102,8 @@ module ValidatesTimeliness
|
|||||||
|
|
||||||
unless instance_method_already_implemented?("#{name}=")
|
unless instance_method_already_implemented?("#{name}=")
|
||||||
if [:date, :time, :datetime].include?(column.type)
|
if [:date, :time, :datetime].include?(column.type)
|
||||||
define_write_method_for_dates_and_times(name)
|
time_zone_aware = create_time_zone_conversion_attribute?(name, column) rescue false
|
||||||
|
define_write_method_for_dates_and_times(name, column.type, time_zone_aware)
|
||||||
else
|
else
|
||||||
define_write_method(name.to_sym)
|
define_write_method(name.to_sym)
|
||||||
end
|
end
|
||||||
@@ -116,32 +116,19 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Define write method for date, time and datetime columns
|
# Define write method for date, time and datetime columns
|
||||||
def define_write_method_for_dates_and_times(attr_name)
|
def define_write_method_for_dates_and_times(attr_name, type, time_zone_aware)
|
||||||
method_body = <<-EOV
|
method_body = <<-EOV
|
||||||
def #{attr_name}=(value)
|
def #{attr_name}=(value)
|
||||||
write_date_time_attribute('#{attr_name}', value)
|
write_date_time_attribute('#{attr_name}', value, #{type.inspect}, #{time_zone_aware})
|
||||||
end
|
end
|
||||||
EOV
|
EOV
|
||||||
evaluate_attribute_method attr_name, method_body, "#{attr_name}="
|
evaluate_attribute_method attr_name, method_body, "#{attr_name}="
|
||||||
end
|
end
|
||||||
|
|
||||||
# Define time attribute reader. If reloading then check if cached,
|
def define_read_method_for_dates_and_times(attr_name, type, time_zone_aware)
|
||||||
# which means its in local time. If local, convert with parser as local
|
|
||||||
# timezone, otherwise use read_attribute method for quick default type
|
|
||||||
# cast of values from database using default timezone.
|
|
||||||
def define_read_method_for_time_zone_conversion(attr_name)
|
|
||||||
method_body = <<-EOV
|
method_body = <<-EOV
|
||||||
def #{attr_name}(reload = false)
|
def #{attr_name}(reload = false)
|
||||||
cached = @attributes_cache['#{attr_name}']
|
read_date_time_attribute('#{attr_name}', #{type.inspect}, #{time_zone_aware}, reload)
|
||||||
return cached if @attributes_cache.has_key?('#{attr_name}') && !reload
|
|
||||||
if @attributes_cache.has_key?('#{attr_name}')
|
|
||||||
time = read_attribute_before_type_cast('#{attr_name}')
|
|
||||||
time = self.class.parse_date_time(date, :datetime)
|
|
||||||
else
|
|
||||||
time = read_attribute('#{attr_name}')
|
|
||||||
@attributes['#{attr_name}'] = time.in_time_zone rescue nil
|
|
||||||
end
|
|
||||||
@attributes_cache['#{attr_name}'] = time.in_time_zone rescue nil
|
|
||||||
end
|
end
|
||||||
EOV
|
EOV
|
||||||
evaluate_attribute_method attr_name, method_body
|
evaluate_attribute_method attr_name, method_body
|
||||||
|
|||||||
@@ -10,16 +10,14 @@ module ValidatesTimeliness
|
|||||||
# string values.
|
# string values.
|
||||||
#
|
#
|
||||||
class Formats
|
class Formats
|
||||||
cattr_accessor :time_formats
|
cattr_accessor :time_formats,
|
||||||
cattr_accessor :date_formats
|
:date_formats,
|
||||||
cattr_accessor :datetime_formats
|
:datetime_formats,
|
||||||
|
:time_expressions,
|
||||||
cattr_accessor :time_expressions
|
:date_expressions,
|
||||||
cattr_accessor :date_expressions
|
:datetime_expressions,
|
||||||
cattr_accessor :datetime_expressions
|
:format_tokens,
|
||||||
|
:format_proc_args
|
||||||
cattr_accessor :format_tokens
|
|
||||||
cattr_accessor :format_proc_args
|
|
||||||
|
|
||||||
# Format tokens:
|
# Format tokens:
|
||||||
# y = year
|
# y = year
|
||||||
@@ -139,13 +137,13 @@ module ValidatesTimeliness
|
|||||||
# should just be the arg name.
|
# should just be the arg name.
|
||||||
#
|
#
|
||||||
@@format_proc_args = {
|
@@format_proc_args = {
|
||||||
:year => [0, 'y', 'unambiguous_year(y)'],
|
:year => [0, 'y', 'unambiguous_year(y)'],
|
||||||
:month => [1, 'm', 'month_index(m)'],
|
:month => [1, 'm', 'month_index(m)'],
|
||||||
:day => [2, 'd', 'd'],
|
:day => [2, 'd', 'd'],
|
||||||
:hour => [3, 'h', 'full_hour(h,md)'],
|
:hour => [3, 'h', 'full_hour(h,md)'],
|
||||||
:min => [4, 'n', 'n'],
|
:min => [4, 'n', 'n'],
|
||||||
:sec => [5, 's', 's'],
|
:sec => [5, 's', 's'],
|
||||||
:usec => [6, 'u', 'microseconds(u)'],
|
:usec => [6, 'u', 'microseconds(u)'],
|
||||||
:meridian => [nil, 'md', nil]
|
:meridian => [nil, 'md', nil]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,16 +162,17 @@ module ValidatesTimeliness
|
|||||||
def parse(string, type, strict=true)
|
def parse(string, type, strict=true)
|
||||||
return string unless string.is_a?(String)
|
return string unless string.is_a?(String)
|
||||||
|
|
||||||
expressions = expression_set(type, string)
|
matches = nil
|
||||||
time_array = nil
|
exp, processor = expression_set(type, string).find do |regexp, proc|
|
||||||
expressions.each do |(regexp, processor)|
|
full = /\A#{regexp}\Z/ if strict
|
||||||
regexp = strict || type == :datetime ? /\A#{regexp}\Z/ : (type == :date ? /\A#{regexp}/ : /#{regexp}\Z/)
|
full ||= case type
|
||||||
if matches = regexp.match(string.strip)
|
when :datetime then /\A#{regexp}\Z/
|
||||||
time_array = processor.call(*matches[1..7])
|
when :date then /\A#{regexp}/
|
||||||
break
|
else /#{regexp}\Z/
|
||||||
end
|
end
|
||||||
|
matches = full.match(string.strip)
|
||||||
end
|
end
|
||||||
return time_array
|
processor.call(*matches[1..7]) if matches
|
||||||
end
|
end
|
||||||
|
|
||||||
# Delete formats of specified type. Error raised if format not found.
|
# Delete formats of specified type. Error raised if format not found.
|
||||||
@@ -223,7 +222,7 @@ module ValidatesTimeliness
|
|||||||
def format_expression_generator(string_format)
|
def format_expression_generator(string_format)
|
||||||
regexp = string_format.dup
|
regexp = string_format.dup
|
||||||
order = {}
|
order = {}
|
||||||
regexp.gsub!(/([\.\\])/, '\\\\\1') # escapes dots and backslashes ]/
|
regexp.gsub!(/([\.\\])/, '\\\\\1') # escapes dots and backslashes
|
||||||
|
|
||||||
format_tokens.each do |token|
|
format_tokens.each do |token|
|
||||||
token_name = token.keys.first
|
token_name = token.keys.first
|
||||||
@@ -260,7 +259,7 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile_formats(formats)
|
def compile_formats(formats)
|
||||||
formats.collect { |format| regexp, format_proc = format_expression_generator(format) }
|
formats.map { |format| regexp, format_proc = format_expression_generator(format) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Pick expression set and combine date and datetimes for
|
# Pick expression set and combine date and datetimes for
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ module Spec
|
|||||||
restriction = [restriction] unless restriction.is_a?(Array)
|
restriction = [restriction] unless restriction.is_a?(Array)
|
||||||
restriction.map! {|r| @validator.send(:type_cast_value, r) }
|
restriction.map! {|r| @validator.send(:type_cast_value, r) }
|
||||||
interpolate = @validator.send(:interpolation_values, option, restriction )
|
interpolate = @validator.send(:interpolation_values, option, restriction )
|
||||||
if defined?(I18n)
|
# get I18n message if defined and has interpolation keys in msg
|
||||||
|
if defined?(I18n) && !@validator.send(:custom_error_messages).include?(option)
|
||||||
msg = @record.errors.generate_message(@expected, option, interpolate)
|
msg = @record.errors.generate_message(@expected, option, interpolate)
|
||||||
else
|
else
|
||||||
msg = msg % interpolate
|
msg = msg % interpolate
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ module ValidatesTimeliness
|
|||||||
return @custom_error_messages if defined?(@custom_error_messages)
|
return @custom_error_messages if defined?(@custom_error_messages)
|
||||||
@custom_error_messages = configuration.inject({}) {|msgs, (k, v)|
|
@custom_error_messages = configuration.inject({}) {|msgs, (k, v)|
|
||||||
if md = /(.*)_message$/.match(k.to_s)
|
if md = /(.*)_message$/.match(k.to_s)
|
||||||
msgs[md[0].to_sym] = v
|
msgs[md[1].to_sym] = v
|
||||||
end
|
end
|
||||||
msgs
|
msgs
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,24 @@ describe ValidatesTimeliness::ActiveRecord::AttributeMethods do
|
|||||||
@person.birth_date_and_time = "2000-01-01 12:00"
|
@person.birth_date_and_time = "2000-01-01 12:00"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should call read_date_time_attribute when date attribute is retrieved" do
|
||||||
|
@person.should_receive(:read_date_time_attribute)
|
||||||
|
@person.birth_date = "2000-01-01"
|
||||||
|
@person.birth_date
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should call read_date_time_attribute when time attribute is retrieved" do
|
||||||
|
@person.should_receive(:read_date_time_attribute)
|
||||||
|
@person.birth_time = "12:00"
|
||||||
|
@person.birth_time
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should call rea_date_time_attribute when datetime attribute is retrieved" do
|
||||||
|
@person.should_receive(:read_date_time_attribute)
|
||||||
|
@person.birth_date_and_time = "2000-01-01 12:00"
|
||||||
|
@person.birth_date_and_time
|
||||||
|
end
|
||||||
|
|
||||||
it "should call parser on write for datetime attribute" do
|
it "should call parser on write for datetime attribute" do
|
||||||
@person.class.should_receive(:parse_date_time).once
|
@person.class.should_receive(:parse_date_time).once
|
||||||
@person.birth_date_and_time = "2000-01-01 02:03:04"
|
@person.birth_date_and_time = "2000-01-01 02:03:04"
|
||||||
|
|||||||
@@ -5,27 +5,39 @@ end
|
|||||||
|
|
||||||
class WithValidation < Person
|
class WithValidation < Person
|
||||||
validates_date :birth_date,
|
validates_date :birth_date,
|
||||||
:before => '2000-01-10', :after => '2000-01-01',
|
:before => '2000-01-10',
|
||||||
:on_or_before => '2000-01-09', :on_or_after => '2000-01-02',
|
:after => '2000-01-01',
|
||||||
|
:on_or_before => '2000-01-09',
|
||||||
|
:on_or_after => '2000-01-02',
|
||||||
:between => ['2000-01-01', '2000-01-03']
|
:between => ['2000-01-01', '2000-01-03']
|
||||||
|
|
||||||
validates_time :birth_time,
|
validates_time :birth_time,
|
||||||
:before => '23:00', :after => '09:00',
|
:before => '23:00',
|
||||||
:on_or_before => '22:00', :on_or_after => '10:00',
|
:after => '09:00',
|
||||||
|
:on_or_before => '22:00',
|
||||||
|
:on_or_after => '10:00',
|
||||||
:between => ['09:00', '17:00']
|
:between => ['09:00', '17:00']
|
||||||
|
|
||||||
validates_datetime :birth_date_and_time,
|
validates_datetime :birth_date_and_time,
|
||||||
:before => '2000-01-10 23:00', :after => '2000-01-01 09:00',
|
:before => '2000-01-10 23:00',
|
||||||
:on_or_before => '2000-01-09 23:00', :on_or_after => '2000-01-02 09:00',
|
:after => '2000-01-01 09:00',
|
||||||
|
:on_or_before => '2000-01-09 23:00',
|
||||||
|
:on_or_after => '2000-01-02 09:00',
|
||||||
:between => ['2000-01-01 09:00', '2000-01-01 17:00']
|
:between => ['2000-01-01 09:00', '2000-01-01 17:00']
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class CustomMessages < Person
|
class CustomMessages < Person
|
||||||
validates_date :birth_date, :invalid_date_message => 'is not really a date',
|
validates_date :birth_date,
|
||||||
:before => '2000-01-10', :before_message => 'is too late',
|
:invalid_date_message => 'is not really a date',
|
||||||
:after => '2000-01-01', :after_message => 'is too early',
|
:before => '2000-01-10',
|
||||||
:on_or_before=> '2000-01-09', :on_or_before_message => 'is just too late',
|
:before_message => 'is too late',
|
||||||
:on_or_after => '2000-01-02', :on_or_after_message => 'is just too early'
|
:after => '2000-01-01',
|
||||||
|
:after_message => 'is too early',
|
||||||
|
:on_or_before => '2000-01-09',
|
||||||
|
:on_or_before_message => 'is just too late',
|
||||||
|
:on_or_after => '2000-01-02',
|
||||||
|
:on_or_after_message => 'is just too early'
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "ValidateTimeliness matcher" do
|
describe "ValidateTimeliness matcher" do
|
||||||
|
|||||||
@@ -363,6 +363,40 @@ describe ValidatesTimeliness::Validator do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "custom_error_messages" do
|
||||||
|
it "should return hash of custom error messages from configuration with _message truncated from keys" do
|
||||||
|
configure_validator(:type => :date, :invalid_date_message => 'thats no date')
|
||||||
|
validator.send(:custom_error_messages)[:invalid_date].should == 'thats no date'
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return empty hash if no custom error messages in configuration" do
|
||||||
|
configure_validator(:type => :date)
|
||||||
|
validator.send(:custom_error_messages).should be_empty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "interpolation_values" do
|
||||||
|
if defined?(I18n)
|
||||||
|
it "should return hash of interpolation keys with restriction values" do
|
||||||
|
before = '1900-01-01'
|
||||||
|
configure_validator(:type => :date, :before => before)
|
||||||
|
validator.send(:interpolation_values, :before, before.to_date).should == {:restriction => before}
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return empty hash if no interpolation keys are in message" do
|
||||||
|
before = '1900-01-01'
|
||||||
|
configure_validator(:type => :date, :before => before, :before_message => 'too late')
|
||||||
|
validator.send(:interpolation_values, :before, before.to_date).should be_empty
|
||||||
|
end
|
||||||
|
else
|
||||||
|
it "should return array of interpolation values" do
|
||||||
|
before = '1900-01-01'
|
||||||
|
configure_validator(:type => :date, :before => before)
|
||||||
|
validator.send(:interpolation_values, :before, before.to_date).should == [before]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "restriction errors" do
|
describe "restriction errors" do
|
||||||
before :each do
|
before :each do
|
||||||
configure_validator(:type => :date, :before => lambda { raise })
|
configure_validator(:type => :date, :before => lambda { raise })
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = %q{validates_timeliness}
|
s.name = %q{validates_timeliness}
|
||||||
s.version = "1.1.1"
|
s.version = "1.1.3"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Adam Meehan"]
|
s.authors = ["Adam Meehan"]
|
||||||
s.autorequire = %q{validates_timeliness}
|
s.autorequire = %q{validates_timeliness}
|
||||||
s.date = %q{2009-01-03}
|
s.date = %q{2009-01-13}
|
||||||
s.description = %q{Date and time validation plugin for Rails 2.x which allows custom formats}
|
s.description = %q{Date and time validation plugin for Rails 2.x which allows custom formats}
|
||||||
s.email = %q{adam.meehan@gmail.com}
|
s.email = %q{adam.meehan@gmail.com}
|
||||||
s.extra_rdoc_files = ["README.rdoc", "LICENSE", "TODO", "CHANGELOG"]
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE", "TODO", "CHANGELOG"]
|
||||||
|
|||||||
Reference in New Issue
Block a user