Sha256: 9a6a27b46f7928f551d87e0a8340d1d098f4a0da6f1f2dd7c1c1dfb4d88b51e6

Contents?: true

Size: 1.17 KB

Versions: 69

Compression:

Stored size: 1.17 KB

Contents

require "#{File.dirname(__FILE__)}/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

Version data entries

69 entries across 69 versions & 3 rubygems

Version Path
backlog-0.0.0 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.0.1 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.0.2 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.0.4 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.0.5 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.1.0 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.1.1 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.1.2 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.2.0 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.2.1 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.0 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.2 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.3 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.1 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.4 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.5 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.6 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.8 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.7 vendor/rails/railties/test/rails_info_controller_test.rb
backlog-0.3.9 vendor/rails/railties/test/rails_info_controller_test.rb