mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
Update the date formatting syntax
This commit is contained in:
parent
3fc943ce2a
commit
13bdef74b3
14 changed files with 36 additions and 36 deletions
|
@ -11,7 +11,7 @@ xml.rss :version => "2.0" do
|
|||
xml.item do
|
||||
xml.title h(context.title)
|
||||
xml.description context_summary(context, count_undone_todos_phrase(context))
|
||||
xml.pubDate context.created_at.to_s(:rfc822)
|
||||
xml.pubDate context.created_at.to_formatted_s(:rfc822)
|
||||
xml.link context_url(context)
|
||||
xml.guid context_url(context)
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ xml.rss :version => "2.0" do
|
|||
xml.item do
|
||||
xml.title h(todo.description)
|
||||
xml.description feed_content_for_todo(todo)
|
||||
xml.pubDate todo.created_at.to_s(:rfc822)
|
||||
xml.pubDate todo.created_at.to_formatted_s(:rfc822)
|
||||
xml.link (todo.project && !todo.project.is_a?(NullProject)) ? project_url(todo.project) : context_url(todo.context)
|
||||
xml.guid todo_url(todo)
|
||||
end
|
||||
|
|
|
@ -124,7 +124,7 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
%w(guid link).each do |node|
|
||||
assert_select node, /http:\/\/test.host\/contexts\/.+/
|
||||
end
|
||||
assert_select 'pubDate', contexts(:agenda).created_at.to_s(:rfc822)
|
||||
assert_select 'pubDate', contexts(:agenda).created_at.to_formatted_s(:rfc822)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -102,7 +102,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
%w(guid link).each do |node|
|
||||
assert_select node, /http:\/\/test.host\/projects\/.+/
|
||||
end
|
||||
assert_select 'pubDate', projects(:timemachine).updated_at.to_s(:rfc822)
|
||||
assert_select 'pubDate', projects(:timemachine).updated_at.to_formatted_s(:rfc822)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -403,7 +403,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert_equal "bar, foo", t.tag_list
|
||||
expected = Date.new(2006,11,30)
|
||||
actual = t.due.to_date
|
||||
assert_equal expected, actual, "Expected #{expected.to_s(:db)}, was #{actual.to_s(:db)}"
|
||||
assert_equal expected, actual, "Expected #{expected.to_formatted_s(:db)}, was #{actual.to_formatted_s(:db)}"
|
||||
end
|
||||
|
||||
def test_update_todos_with_blank_project_name
|
||||
|
@ -551,7 +551,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert_select 'description', /.*/
|
||||
assert_select 'link', %r{http://test.host/contexts/.+}
|
||||
assert_select 'guid', %r{http://test.host/todos/.+}
|
||||
assert_select 'pubDate', todos(:call_bill_gates_every_day).created_at.to_s(:rfc822)
|
||||
assert_select 'pubDate', todos(:call_bill_gates_every_day).created_at.to_formatted_s(:rfc822)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
2
test/fixtures/contexts.yml
vendored
2
test/fixtures/contexts.yml
vendored
|
@ -5,7 +5,7 @@
|
|||
<%
|
||||
|
||||
def today
|
||||
Time.zone.now.utc.to_s(:db)
|
||||
Time.zone.now.utc.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
%>
|
||||
|
|
6
test/fixtures/notes.yml
vendored
6
test/fixtures/notes.yml
vendored
|
@ -4,15 +4,15 @@
|
|||
# rails does automatically in models or controllers! Convert to utc manually!
|
||||
<%
|
||||
def today
|
||||
Time.zone.now.utc.to_s(:db)
|
||||
Time.zone.now.utc.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.utc.to_s(:db)
|
||||
1.week.from_now.utc.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def last_week
|
||||
1.week.ago.utc.to_s(:db)
|
||||
1.week.ago.utc.to_formatted_s(:db)
|
||||
end
|
||||
%>
|
||||
|
||||
|
|
6
test/fixtures/projects.yml
vendored
6
test/fixtures/projects.yml
vendored
|
@ -4,13 +4,13 @@
|
|||
# rails does automatically in models or controllers! Convert to utc manually!
|
||||
<%
|
||||
def today
|
||||
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
||||
Time.zone.now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
def yesterday
|
||||
1.day.ago.utc.beginning_of_day.to_s(:db)
|
||||
1.day.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
def last_week
|
||||
1.week.ago.utc.beginning_of_day.to_s(:db)
|
||||
1.week.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
%>
|
||||
|
||||
|
|
12
test/fixtures/recurring_todos.yml
vendored
12
test/fixtures/recurring_todos.yml
vendored
|
@ -3,27 +3,27 @@
|
|||
|
||||
<%
|
||||
def today
|
||||
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
||||
Time.zone.now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.utc.beginning_of_day.to_s(:db)
|
||||
1.week.from_now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def last_week
|
||||
1.week.ago.utc.beginning_of_day.to_s(:db)
|
||||
1.week.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def two_weeks_ago
|
||||
2.weeks.ago.utc.beginning_of_day.to_s(:db)
|
||||
2.weeks.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def two_weeks_hence
|
||||
2.weeks.from_now.utc.beginning_of_day.to_s(:db)
|
||||
2.weeks.from_now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def way_back
|
||||
Time.zone.local(2008,1,1).utc.to_s(:db)
|
||||
Time.zone.local(2008,1,1).utc.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
%>
|
||||
|
|
2
test/fixtures/tags.yml
vendored
2
test/fixtures/tags.yml
vendored
|
@ -3,7 +3,7 @@
|
|||
|
||||
<%
|
||||
def today
|
||||
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
||||
Time.zone.now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
%>
|
||||
|
||||
|
|
12
test/fixtures/todos.yml
vendored
12
test/fixtures/todos.yml
vendored
|
@ -8,27 +8,27 @@ def yesterday
|
|||
Time.zone.now.utc.beginning_of_day - 1.day
|
||||
end
|
||||
def today
|
||||
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
||||
Time.zone.now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def tomorrow
|
||||
(Time.zone.now.utc.beginning_of_day + 1.day).to_s(:db)
|
||||
(Time.zone.now.utc.beginning_of_day + 1.day).to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.utc.beginning_of_day.to_s(:db)
|
||||
1.week.from_now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def last_week
|
||||
1.week.ago.utc.beginning_of_day.to_s(:db)
|
||||
1.week.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def two_weeks_ago
|
||||
2.weeks.ago.utc.beginning_of_day.to_s(:db)
|
||||
2.weeks.ago.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
def two_weeks_hence
|
||||
2.weeks.from_now.utc.beginning_of_day.to_s(:db)
|
||||
2.weeks.from_now.utc.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
%>
|
||||
|
|
|
@ -110,7 +110,7 @@ class RecurringTodoTest < ActiveSupport::TestCase
|
|||
# every_day should return start_day if it is in the future
|
||||
@every_day.start_from = @in_three_days
|
||||
due_date = @every_day.get_due_date(nil)
|
||||
assert_equal @in_three_days.at_midnight.to_s(:db), due_date.to_s(:db)
|
||||
assert_equal @in_three_days.at_midnight.to_formatted_s(:db), due_date.to_formatted_s(:db)
|
||||
due_date = @every_day.get_due_date(@tomorrow)
|
||||
assert_equal @in_three_days.at_midnight, due_date
|
||||
|
||||
|
|
|
@ -122,8 +122,8 @@ module RecurringTodos
|
|||
travel_to Time.zone.local(2013,1,1) do
|
||||
rt = create_recurring_todo
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil), "no previous date, use today"
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil, 1.day).to_s(:db), "no previous date, use today without offset"
|
||||
assert_equal Time.zone.parse("2013-01-02 00:00:00"), rt.send(:determine_start, Time.zone.now, 1.day).to_s(:db), "use previous date and offset"
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil, 1.day).to_formatted_s(:db), "no previous date, use today without offset"
|
||||
assert_equal Time.zone.parse("2013-01-02 00:00:00"), rt.send(:determine_start, Time.zone.now, 1.day).to_formatted_s(:db), "use previous date and offset"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -131,14 +131,14 @@ module RecurringTodos
|
|||
rt = create_recurring_todo
|
||||
|
||||
# march 2014 has 5 saturdays, the last will return the 5th
|
||||
assert_equal Time.zone.parse("2014-03-01 00:00:00"), rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-22 00:00:00"), rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-29 00:00:00"), rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-01 00:00:00"), rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-22 00:00:00"), rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-29 00:00:00"), rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_formatted_s(:db)
|
||||
|
||||
# march 2014 has 4 fridays, the last will return the 4th
|
||||
assert_equal Time.zone.parse("2014-03-07 00:00:00"), rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-07 00:00:00"), rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_formatted_s(:db)
|
||||
|
||||
assert_raise(RuntimeError, "should check on valid weekdays"){ rt.send(:get_xth_day_of_month, 5, 9, 3, 2014) }
|
||||
assert_raise(RuntimeError, "should check on valid count x"){ rt.send(:get_xth_day_of_month, 6, 5, 3, 2014) }
|
||||
|
|
|
@ -10,7 +10,7 @@ class TodoTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.beginning_of_day.to_s(:db)
|
||||
1.week.from_now.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
# Test loading a todo item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue