Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
635aa912
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,发现更多精彩内容 >>
提交
635aa912
编写于
10月 05, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More robust console test
上级
76d82367
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
43 deletion
+56
-43
railties/test/application/console_test.rb
railties/test/application/console_test.rb
+52
-0
railties/test/console_app_test.rb
railties/test/console_app_test.rb
+0
-43
railties/test/isolation/abstract_unit.rb
railties/test/isolation/abstract_unit.rb
+4
-0
未找到文件。
railties/test/application/console_test.rb
0 → 100644
浏览文件 @
635aa912
require
'isolation/abstract_unit'
class
ConsoleTest
<
Test
::
Unit
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
boot_rails
# Load steps taken from rails/commands/console.rb
require
"
#{
rails_root
}
/config/environment"
require
'rails/console_app'
require
'rails/console_with_helpers'
end
def
test_app_method_should_return_integration_session
console_session
=
app
assert_not_nil
console_session
assert_instance_of
ActionController
::
Integration
::
Session
,
console_session
end
def
test_new_session_should_return_integration_session
session
=
new_session
assert_not_nil
session
assert_instance_of
ActionController
::
Integration
::
Session
,
session
end
def
test_reload_should_fire_preparation_callbacks
a
=
b
=
c
=
nil
# TODO: These should be defined on the initializer
ActionDispatch
::
Callbacks
.
to_prepare
{
a
=
b
=
c
=
1
}
ActionDispatch
::
Callbacks
.
to_prepare
{
b
=
c
=
2
}
ActionDispatch
::
Callbacks
.
to_prepare
{
c
=
3
}
# Hide Reloading... output
silence_stream
(
STDOUT
)
do
reload!
end
assert_equal
1
,
a
assert_equal
2
,
b
assert_equal
3
,
c
end
def
test_access_to_helpers
assert_not_nil
helper
assert_instance_of
ActionView
::
Base
,
helper
assert_equal
'Once upon a time in a world...'
,
helper
.
truncate
(
'Once upon a time in a world far far away'
)
end
end
railties/test/console_app_test.rb
已删除
100644 → 0
浏览文件 @
76d82367
require
'abstract_unit'
require
'action_controller'
# console_app uses 'action_controller/integration'
require
'rails/dispatcher'
require
'rails/console_app'
module
Rails
def
self
.
application
ActionController
::
Routing
::
Routes
end
end
# console_app sets Test::Unit.run to work around the at_exit hook in test/unit, which kills IRB
if
Test
::
Unit
.
respond_to?
(
:run
=
)
Test
::
Unit
.
run
=
false
class
ConsoleAppTest
<
Test
::
Unit
::
TestCase
def
test_app_method_should_return_integration_session
assert_nothing_thrown
do
console_session
=
app
assert_not_nil
console_session
assert_instance_of
ActionController
::
Integration
::
Session
,
console_session
end
end
def
test_reload_should_fire_preparation_callbacks
a
=
b
=
c
=
nil
ActionDispatch
::
Callbacks
.
to_prepare
{
a
=
b
=
c
=
1
}
ActionDispatch
::
Callbacks
.
to_prepare
{
b
=
c
=
2
}
ActionDispatch
::
Callbacks
.
to_prepare
{
c
=
3
}
ActionController
::
Routing
::
Routes
.
expects
(
:reload
)
reload!
assert_equal
1
,
a
assert_equal
2
,
b
assert_equal
3
,
c
end
end
end
railties/test/isolation/abstract_unit.rb
浏览文件 @
635aa912
...
...
@@ -30,6 +30,10 @@ def tmp_path(*args)
def
app_path
(
*
args
)
tmp_path
(
*
%w[app]
+
args
)
end
def
rails_root
app_path
end
end
module
Rack
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录