Commit 4a051199 authored by Leandro Nunes's avatar Leandro Nunes
Browse files

adapting tests for datetime values

parent f759d50d
......@@ -1563,8 +1563,8 @@ class ProfileTest < ActiveSupport::TestCase
should 'list all events' do
profile = fast_create(Profile)
event1 = Event.new(:name => 'Ze Birthday', :start_date => Date.today)
event2 = Event.new(:name => 'Mane Birthday', :start_date => Date.today >> 1)
event1 = Event.new(:name => 'Ze Birthday', :start_date => DateTime.now)
event2 = Event.new(:name => 'Mane Birthday', :start_date => DateTime.now >> 1)
profile.events << [event1, event2]
assert_includes profile.events, event1
assert_includes profile.events, event2
......@@ -1586,7 +1586,7 @@ class ProfileTest < ActiveSupport::TestCase
should 'list events by month' do
profile = fast_create(Profile)
today = Date.new(2014, 03, 2)
today = DateTime.new(2014, 03, 2)
yesterday_event = Event.new(:name => 'Joao Birthday', :start_date => today - 1.day)
today_event = Event.new(:name => 'Ze Birthday', :start_date => today)
tomorrow_event = Event.new(:name => 'Mane Birthday', :start_date => today + 1.day)
......@@ -1613,7 +1613,7 @@ class ProfileTest < ActiveSupport::TestCase
should 'not list events out of range' do
profile = fast_create(Profile)
today = Date.today
today = DateTime.now
event_in_range1 = Event.new(:name => 'Foswiki Conference', :start_date => today - 2.day, :end_date => today + 2.day)
event_in_range2 = Event.new(:name => 'Debian Conference', :start_date => today - 2.day, :end_date => today + 3.day)
event_out_of_range = Event.new(:name => 'Ze Birthday', :start_date => today - 5.day, :end_date => today - 3.day)
......@@ -1627,9 +1627,9 @@ class ProfileTest < ActiveSupport::TestCase
should 'sort events by date' do
profile = fast_create(Profile)
event1 = Event.new(:name => 'Noosfero Hackaton', :start_date => Date.today)
event2 = Event.new(:name => 'Debian Day', :start_date => Date.today - 1)
event3 = Event.new(:name => 'Fisl 10', :start_date => Date.today + 1)
event1 = Event.new(:name => 'Noosfero Hackaton', :start_date => DateTime.now)
event2 = Event.new(:name => 'Debian Day', :start_date => DateTime.now - 1)
event3 = Event.new(:name => 'Fisl 10', :start_date => DateTime.now + 1)
profile.events << [event1, event2, event3]
assert_equal [event2, event1, event3], profile.events
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment