Upgraded to Rails 2.1. This can have wide ranging consequences, so please help track down any issues introduced by the upgrade. Requires environment.rb modifications.

Changes you will need to make:

 * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl
 * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install.

Other notes on my changes:

 * Modified our code to take advantage of Rails 2.1's slick time zone support.
 * Upgraded will_paginate for compatibility
 * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1
 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
This commit is contained in:
Luke Melia 2008-06-17 01:13:25 -04:00
parent f3bae73868
commit 901a58f8a3
1086 changed files with 51452 additions and 19526 deletions

View file

@ -1,7 +1,7 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
<%
def today
Time.now.utc.beginning_of_day.to_s(:db)
Time.zone.now.beginning_of_day.to_s(:db)
end
%>

View file

@ -2,23 +2,23 @@
<%
def today
Time.now.utc.beginning_of_day.to_s(:db)
Time.zone.now.beginning_of_day.to_s(:db)
end
def next_week
1.week.from_now.beginning_of_day.utc.to_s(:db)
1.week.from_now.beginning_of_day.to_s(:db)
end
def last_week
1.week.ago.utc.beginning_of_day.to_s(:db)
1.week.ago.beginning_of_day.to_s(:db)
end
def two_weeks_ago
2.weeks.ago.utc.beginning_of_day.to_s(:db)
2.weeks.ago.beginning_of_day.to_s(:db)
end
def two_weeks_hence
2.weeks.from_now.utc.beginning_of_day.to_s(:db)
2.weeks.from_now.beginning_of_day.to_s(:db)
end
%>

View file

@ -103,7 +103,7 @@ class ContextsControllerTest < TodoContainerControllerTestBase
assert_select 'p', /\d+&nbsp;actions. Context is (Active|Hidden)./
end
end
assert_select 'published', /(#{contexts(:agenda).created_at.xmlschema}|#{contexts(:library).created_at.xmlschema})/
assert_select 'published', /(#{Regexp.escape(contexts(:agenda).created_at.xmlschema)}|#{Regexp.escape(contexts(:library).created_at.xmlschema)})/
end
end
end

View file

@ -160,7 +160,7 @@ class ProjectsControllerTest < TodoContainerControllerTestBase
assert_select 'p', /\d+&nbsp;actions. Project is (active|hidden|completed)./
end
end
assert_select 'published', /(#{projects(:timemachine).updated_at.xmlschema}|#{projects(:moremoney).updated_at.xmlschema})/
assert_select 'published', /(#{Regexp.escape(projects(:timemachine).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
end
end
end

View file

@ -245,7 +245,7 @@ class TodosControllerTest < Test::Rails::TestCase
assert_xml_select 'entry', 10 do
assert_xml_select 'title', /.+/
assert_xml_select 'content[type="html"]', /.*/
assert_xml_select 'published', /(#{projects(:timemachine).updated_at.xmlschema}|#{projects(:moremoney).updated_at.xmlschema})/
assert_xml_select 'published', /(#{Regexp.escape(projects(:timemachine).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
end
end
end

View file

@ -12,8 +12,6 @@ class SeleniumHelperController < ActionController::Base
end
end
ActionController::Routing::Routes.add_route '/selenium_helper/login', :controller => 'selenium_helper', :action => 'login'
module SeleniumOnRails::TestBuilderActions
def login options = {}
options = {options => nil} unless options.is_a? Hash

View file

@ -12,7 +12,6 @@ class PreferenceTest < Test::Rails::TestCase
def test_time_zone
assert_equal 'London', @admin_user.preference.time_zone
assert_equal @admin_user.preference.tz, TimeZone['London']
end
def test_show_project_on_todo_done

View file

@ -19,8 +19,8 @@ class TodoTest < Test::Rails::TestCase
assert_equal "Call Bill Gates to find out how much he makes per day", @not_completed1.description
assert_nil @not_completed1.notes
assert @not_completed1.completed? == false
assert_equal 1.week.ago.utc.beginning_of_day.strftime("%Y-%m-%d %H:%M"), @not_completed1.created_at.strftime("%Y-%m-%d %H:%M")
assert_equal 2.week.from_now.utc.beginning_of_day.strftime("%Y-%m-%d"), @not_completed1.due.strftime("%Y-%m-%d")
assert_equal 1.week.ago.beginning_of_day.strftime("%Y-%m-%d %H:%M"), @not_completed1.created_at.strftime("%Y-%m-%d %H:%M")
assert_equal 2.week.from_now.beginning_of_day.strftime("%Y-%m-%d"), @not_completed1.due.strftime("%Y-%m-%d")
assert_nil @not_completed1.completed_at
assert_equal 1, @not_completed1.user_id
end

View file

@ -10,10 +10,6 @@ class TodosHelperTest < Test::Rails::HelperTestCase
include ApplicationHelper
include TodosHelper
def user_time
Time.now
end
def format_date(date)
if date
date_format = "%d/%m/%Y"
@ -31,7 +27,7 @@ class TodosHelperTest < Test::Rails::HelperTestCase
end
def test_show_date_today
date = Time.now.to_date
date = Time.zone.now.to_date
html = show_date(date)
formatted_date = format_date(date)
assert_equal %Q{<a title="#{formatted_date}"><span class="amber">Show Today</span></a> }, html