schedular 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -16,11 +16,15 @@ module Schedular
16
16
  def dates= dates
17
17
  parsed = Eventual.parse dates, :lang => I18n.locale
18
18
 
19
- self.times = parsed.map do |time|
20
- # TODO: This method is soooo uneficient
21
- all_day = !(DateTime === time)
22
- Schedular::Time.all_day(all_day).by_time_or_period(time).first || Schedular::Time.new(:value => time, :all_day => all_day)
23
- end if parsed
19
+ if parsed
20
+ self.times = parsed.map do |time|
21
+ # TODO: This method is soooo uneficient
22
+ all_day = !(DateTime === time)
23
+ Schedular::Time.all_day(all_day).by_time_or_period(time).first || Schedular::Time.new(:value => time, :all_day => all_day)
24
+ end
25
+ else
26
+ self.times = []
27
+ end
24
28
 
25
29
  self['dates'] = dates
26
30
  end
data/test/test_event.rb CHANGED
@@ -13,9 +13,10 @@ class Schedular::EventTest < Test::Unit::TestCase
13
13
  # should_validate_presence_of :dates
14
14
 
15
15
  should 'not accept bad date' do
16
- event = Schedular::Event.new :dates => 'bad dates', :name => 'evento 1'
17
- assert_equal false, event.valid?
18
- assert_equal I18n.t('activerecord.errors.messages.invalid'), event.errors[:dates]
16
+ @event.dates = 'bad dates'
17
+ assert_equal false, @event.valid?
18
+ assert_equal I18n.t('activerecord.errors.messages.invalid'), @event.errors[:dates]
19
+ assert_equal true, @event.times.blank?
19
20
  end
20
21
 
21
22
  context 'times without time' do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Macario Ortega