mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-29 21:38:49 +01:00
Vendoring Rails 2.3.5
This commit is contained in:
parent
3e83d19299
commit
f8779795ce
943 changed files with 56503 additions and 61351 deletions
|
|
@ -1,7 +1,7 @@
|
|||
require 'abstract_unit'
|
||||
require 'controller/fake_controllers'
|
||||
|
||||
class TestTest < Test::Unit::TestCase
|
||||
class TestTest < ActionController::TestCase
|
||||
class TestController < ActionController::Base
|
||||
def no_op
|
||||
render :text => 'dummy'
|
||||
|
|
@ -23,8 +23,13 @@ class TestTest < Test::Unit::TestCase
|
|||
render :text => 'Success'
|
||||
end
|
||||
|
||||
def reset_the_session
|
||||
reset_session
|
||||
render :text => 'ignore me'
|
||||
end
|
||||
|
||||
def render_raw_post
|
||||
raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
|
||||
raise ActiveSupport::TestCase::Assertion, "#raw_post is blank" if request.raw_post.blank?
|
||||
render :text => request.raw_post
|
||||
end
|
||||
|
||||
|
|
@ -171,6 +176,24 @@ XML
|
|||
assert_equal 'value2', session[:symbol]
|
||||
end
|
||||
|
||||
def test_session_is_cleared_from_controller_after_reset_session
|
||||
process :set_session
|
||||
process :reset_the_session
|
||||
assert_equal Hash.new, @controller.session.to_hash
|
||||
end
|
||||
|
||||
def test_session_is_cleared_from_response_after_reset_session
|
||||
process :set_session
|
||||
process :reset_the_session
|
||||
assert_equal Hash.new, @response.session.to_hash
|
||||
end
|
||||
|
||||
def test_session_is_cleared_from_request_after_reset_session
|
||||
process :set_session
|
||||
process :reset_the_session
|
||||
assert_equal Hash.new, @request.session.to_hash
|
||||
end
|
||||
|
||||
def test_process_with_request_uri_with_no_params
|
||||
process :test_uri
|
||||
assert_equal "/test_test/test/test_uri", @response.body
|
||||
|
|
@ -492,6 +515,14 @@ XML
|
|||
assert_nil @request.instance_variable_get("@request_method")
|
||||
end
|
||||
|
||||
def test_params_reset_after_post_request
|
||||
post :no_op, :foo => "bar"
|
||||
assert_equal "bar", @request.params[:foo]
|
||||
@request.recycle!
|
||||
post :no_op
|
||||
assert @request.params[:foo].blank?
|
||||
end
|
||||
|
||||
%w(controller response request).each do |variable|
|
||||
%w(get post put delete head process).each do |method|
|
||||
define_method("test_#{variable}_missing_for_#{method}_raises_error") do
|
||||
|
|
@ -580,7 +611,7 @@ XML
|
|||
assert_equal @response.redirect_url, redirect_to_url
|
||||
|
||||
# Must be a :redirect response.
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to 'created resource'
|
||||
end
|
||||
end
|
||||
|
|
@ -602,9 +633,9 @@ XML
|
|||
end
|
||||
end
|
||||
|
||||
class CleanBacktraceTest < Test::Unit::TestCase
|
||||
class CleanBacktraceTest < ActionController::TestCase
|
||||
def test_should_reraise_the_same_object
|
||||
exception = Test::Unit::AssertionFailedError.new('message')
|
||||
exception = ActiveSupport::TestCase::Assertion.new('message')
|
||||
clean_backtrace { raise exception }
|
||||
rescue Exception => caught
|
||||
assert_equal exception.object_id, caught.object_id
|
||||
|
|
@ -613,7 +644,7 @@ class CleanBacktraceTest < Test::Unit::TestCase
|
|||
|
||||
def test_should_clean_assertion_lines_from_backtrace
|
||||
path = File.expand_path("#{File.dirname(__FILE__)}/../../lib/action_controller")
|
||||
exception = Test::Unit::AssertionFailedError.new('message')
|
||||
exception = ActiveSupport::TestCase::Assertion.new('message')
|
||||
exception.set_backtrace ["#{path}/abc", "#{path}/assertions/def"]
|
||||
clean_backtrace { raise exception }
|
||||
rescue Exception => caught
|
||||
|
|
@ -629,21 +660,17 @@ class CleanBacktraceTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class InferringClassNameTest < Test::Unit::TestCase
|
||||
class InferringClassNameTest < ActionController::TestCase
|
||||
def test_determine_controller_class
|
||||
assert_equal ContentController, determine_class("ContentControllerTest")
|
||||
end
|
||||
|
||||
def test_determine_controller_class_with_nonsense_name
|
||||
assert_raises ActionController::NonInferrableControllerError do
|
||||
determine_class("HelloGoodBye")
|
||||
end
|
||||
assert_nil determine_class("HelloGoodBye")
|
||||
end
|
||||
|
||||
def test_determine_controller_class_with_sensible_name_where_no_controller_exists
|
||||
assert_raises ActionController::NonInferrableControllerError do
|
||||
determine_class("NoControllerWithThisNameTest")
|
||||
end
|
||||
assert_nil determine_class("NoControllerWithThisNameTest")
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue