Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
20d69384
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
20d69384
编写于
10月 05, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rewrite FCGI handler test
上级
7de5f69c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
34 deletion
+46
-34
railties/lib/rails/fcgi_handler.rb
railties/lib/rails/fcgi_handler.rb
+3
-1
railties/test/abstract_unit.rb
railties/test/abstract_unit.rb
+0
-12
railties/test/application/fcgi_dispatcher_test.rb
railties/test/application/fcgi_dispatcher_test.rb
+43
-21
未找到文件。
railties/lib/rails/fcgi_handler.rb
浏览文件 @
20d69384
...
...
@@ -216,7 +216,9 @@ def mark_features!
def
restore!
$"
.
replace
@features
Dispatcher
.
reset_application!
# TODO: Reloading the application should be the "Application"s
# responsibility
ActionDispatch
::
Callbacks
.
new
(
lambda
{},
true
)
ActionController
::
Routing
::
Routes
.
reload
end
...
...
railties/test/abstract_unit.rb
浏览文件 @
20d69384
...
...
@@ -25,15 +25,3 @@
else
RAILS_ROOT
=
File
.
dirname
(
__FILE__
)
end
def
uses_gem
(
gem_name
,
test_name
,
version
=
'> 0'
)
begin
require
gem_name
.
to_s
rescue
LoadError
gem
gem_name
.
to_s
,
version
require
gem_name
.
to_s
end
yield
rescue
LoadError
$stderr
.
puts
"Skipping
#{
test_name
}
tests. `gem install
#{
gem_name
}
` and try again."
end
railties/test/fcgi_dispatcher_test.rb
→
railties/test/
application/
fcgi_dispatcher_test.rb
浏览文件 @
20d69384
require
'abstract_unit'
require
'isolation/abstract_unit'
require
'mocha'
uses_gem
"fcgi"
,
"0.8.7"
do
begin
require
'action_controller'
require
'rails/fcgi_handler'
module
Rails
def
self
.
application
ActionController
::
Routing
::
Routes
end
begin
require
'fcgi'
rescue
LoadError
gem
'fcgi'
,
'0.8.7'
require
'fcgi'
end
class
RailsFCGIHandlerTest
<
Test
::
Unit
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
boot_rails
require
"
#{
rails_root
}
/config/environment"
require
'rails/fcgi_handler'
@log
=
StringIO
.
new
@handler
=
RailsFCGIHandler
.
new
(
@log
)
end
...
...
@@ -87,7 +94,6 @@ def test_reload
assert_nil
@handler
.
when_ready
end
def
test_reload_runs_gc_when_gc_request_period_set
@handler
.
expects
(
:run_gc!
)
@handler
.
expects
(
:restore!
)
...
...
@@ -111,7 +117,6 @@ def test_restart!
def
test_restore!
$"
.
expects
(
:replace
)
Dispatcher
.
expects
(
:reset_application!
)
ActionController
::
Routing
::
Routes
.
expects
(
:reload
)
@handler
.
send
(
:restore!
)
end
...
...
@@ -127,17 +132,24 @@ def test_uninterrupted_processing
end
end
class
RailsFCGIHandlerSignalsTest
<
Test
::
Unit
::
TestCase
class
::
RailsFCGIHandler
attr_accessor
:signal
alias_method
:old_gc_countdown
,
:gc_countdown
def
gc_countdown
signal
?
Process
.
kill
(
signal
,
$$
)
:
old_gc_countdown
end
end
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
boot_rails
require
"
#{
rails_root
}
/config/environment"
require
'rails/fcgi_handler'
::
RailsFCGIHandler
.
class_eval
do
attr_accessor
:signal
alias_method
:old_gc_countdown
,
:gc_countdown
def
gc_countdown
signal
?
Process
.
kill
(
signal
,
$$
)
:
old_gc_countdown
end
end
@log
=
StringIO
.
new
@handler
=
RailsFCGIHandler
.
new
(
@log
)
@dispatcher
=
mock
...
...
@@ -232,9 +244,16 @@ def test_signal_exception_in_dispatcher
end
end
class
RailsFCGIHandlerPeriodicGCTest
<
Test
::
Unit
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
boot_rails
require
"
#{
rails_root
}
/config/environment"
require
'rails/fcgi_handler'
@log
=
StringIO
.
new
end
...
...
@@ -265,4 +284,7 @@ def test_periodic_gc
assert_nil
@handler
.
when_ready
end
end
end
# uses_gem "fcgi"
rescue
LoadError
$stderr
.
puts
'Skipping fcgi tests. `gem install fcgi` and try again.'
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录