Rails 2.1 RC1

Updated Instiki to Rails 2.1 RC1 (aka 2.0.991).
This commit is contained in:
Jacques Distler 2008-05-17 23:22:34 -05:00
parent 14afed5893
commit 5292899c9a
971 changed files with 46318 additions and 17450 deletions

View file

@ -1,5 +1,5 @@
require File.dirname(__FILE__) + '/../abstract_unit'
require File.dirname(__FILE__) + '/fake_models'
require 'abstract_unit'
require 'controller/fake_models'
module Fun
class GamesController < ActionController::Base
@ -20,6 +20,18 @@ class TestController < ActionController::Base
render :template => "test/hello_world"
end
def render_hello_world_with_forward_slash
render :template => "/test/hello_world"
end
def render_template_in_top_directory
render :template => 'shared'
end
def render_template_in_top_directory_with_slash
render :template => '/shared'
end
def render_hello_world_from_variable
@person = "david"
render :text => "hello #{@person}"
@ -57,6 +69,20 @@ class TestController < ActionController::Base
render :text => "hello world", :status => 404
end
def render_custom_code_rjs
render :update, :status => 404 do |page|
page.replace :foo, :partial => 'partial'
end
end
def render_text_with_nil
render :text => nil
end
def render_text_with_false
render :text => false
end
def render_nothing_with_appendix
render :text => "appended"
end
@ -74,6 +100,15 @@ class TestController < ActionController::Base
render :xml => "<blah/>", :content_type => "application/atomsvc+xml"
end
def render_line_offset
begin
render :inline => '<% raise %>', :locals => {:foo => 'bar'}
rescue => exc
end
line = exc.backtrace.first
render :text => line
end
def heading
head :ok
end
@ -119,14 +154,6 @@ class TestController < ActionController::Base
:locals => { :local_name => name }
end
def accessing_local_assigns_in_inline_template_with_string_keys
name = params[:local_name]
ActionView::Base.local_assigns_support_string_keys = true
render :inline => "<%= 'Goodbye, ' + local_name %>",
:locals => { "local_name" => name }
ActionView::Base.local_assigns_support_string_keys = false
end
def formatted_html_erb
end
@ -213,6 +240,30 @@ class RenderTest < Test::Unit::TestCase
assert_template "test/hello_world"
end
def test_line_offset
get :render_line_offset
line = @response.body
assert(line =~ %r{:(\d+):})
assert_equal "1", $1
end
def test_render_with_forward_slash
get :render_hello_world_with_forward_slash
assert_template "test/hello_world"
end
def test_render_in_top_directory
get :render_template_in_top_directory
assert_template "shared"
assert_equal "Elastica", @response.body
end
def test_render_in_top_directory_with_slash
get :render_template_in_top_directory_with_slash
assert_template "shared"
assert_equal "Elastica", @response.body
end
def test_render_from_variable
get :render_hello_world_from_variable
assert_equal "hello david", @response.body
@ -263,6 +314,23 @@ class RenderTest < Test::Unit::TestCase
assert_equal 'hello world', @response.body
end
def test_render_custom_code_rjs
get :render_custom_code_rjs
assert_response 404
assert_equal %(Element.replace("foo", "partial html");), @response.body
end
def test_render_text_with_nil
get :render_text_with_nil
assert_response 200
assert_equal '', @response.body
end
def test_render_text_with_false
get :render_text_with_false
assert_equal 'false', @response.body
end
def test_render_nothing_with_appendix
get :render_nothing_with_appendix
assert_response 200
@ -343,11 +411,6 @@ class RenderTest < Test::Unit::TestCase
assert_equal "Goodbye, Local David", @response.body
end
def test_accessing_local_assigns_in_inline_template_with_string_keys
get :accessing_local_assigns_in_inline_template_with_string_keys, :local_name => "Local David"
assert_equal "Goodbye, Local David", @response.body
end
def test_render_200_should_set_etag
get :render_hello_world_from_variable
assert_equal etag_for("hello david"), @response.headers['ETag']