From c08d99ffbba9e5cb3eaeb5e005f329cca3b0830b Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 13 Dec 2012 23:23:34 +0400 Subject: [PATCH] #778: update TimeLiving class --- lib/modules/models/time_living.rb | 2 +- spec/models/product_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/models/time_living.rb b/lib/modules/models/time_living.rb index 68742b75f..81ec89dd3 100644 --- a/lib/modules/models/time_living.rb +++ b/lib/modules/models/time_living.rb @@ -12,7 +12,7 @@ module Modules validate lambda { # 2 min <= time_living <= 12 hours - if 120 > time_living || time_living > 43200 + if 120 > time_living.to_i || time_living.to_i > 43200 errors.add(:time_living, I18n.t('flash.time_living.numericality_error')) end } diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index d8068fae6..64af554c3 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -7,7 +7,7 @@ describe Product do Platform.delete_all User.delete_all Product.delete_all - FileUtils.rm_rf(APP_CONFIG['root_path']) + init_test_root # Need for validate_uniqueness_of check FactoryGirl.create(:product) end @@ -28,7 +28,7 @@ describe Product do Platform.delete_all User.delete_all Product.delete_all - FileUtils.rm_rf(APP_CONFIG['root_path']) + clear_test_root end end