mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-23 02:30:12 +01:00
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.
48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
require 'abstract_unit'
|
|
require 'action_controller'
|
|
require 'action_controller/test_process'
|
|
|
|
module Rails; end
|
|
require 'rails/info'
|
|
require 'rails/info_controller'
|
|
|
|
class Rails::InfoController < ActionController::Base
|
|
@local_request = false
|
|
class << self
|
|
cattr_accessor :local_request
|
|
end
|
|
|
|
# Re-raise errors caught by the controller.
|
|
def rescue_action(e) raise e end;
|
|
|
|
protected
|
|
def local_request?
|
|
self.class.local_request
|
|
end
|
|
end
|
|
|
|
ActionController::Routing::Routes.draw do |map|
|
|
map.connect ':controller/:action/:id'
|
|
end
|
|
|
|
class Rails::InfoControllerTest < Test::Unit::TestCase
|
|
def setup
|
|
@controller = Rails::InfoController.new
|
|
@request = ActionController::TestRequest.new
|
|
@response = ActionController::TestResponse.new
|
|
end
|
|
|
|
def test_rails_info_properties_table_rendered_for_local_request
|
|
Rails::InfoController.local_request = true
|
|
get :properties
|
|
assert_tag :tag => 'table'
|
|
assert_response :success
|
|
end
|
|
|
|
def test_rails_info_properties_error_rendered_for_non_local_request
|
|
Rails::InfoController.local_request = false
|
|
get :properties
|
|
assert_tag :tag => 'p'
|
|
assert_response 500
|
|
end
|
|
end
|