Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6fae9ac5
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,发现更多精彩内容 >>
提交
6fae9ac5
编写于
4月 10, 2014
作者:
D
David Rodríguez de Dios
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Isolate debugger related code
上级
eb2d555f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
24 deletion
+32
-24
railties/lib/rails/commands/console.rb
railties/lib/rails/commands/console.rb
+13
-11
railties/test/commands/console_test.rb
railties/test/commands/console_test.rb
+19
-13
未找到文件。
railties/lib/rails/commands/console.rb
浏览文件 @
6fae9ac5
...
@@ -76,9 +76,19 @@ def set_environment!
...
@@ -76,9 +76,19 @@ def set_environment!
Rails
.
env
=
environment
Rails
.
env
=
environment
end
end
def
debugger?
if
RUBY_VERSION
<
'2.0.0'
options
[
:debugger
]
def
debugger?
end
if
RUBY_VERSION
<
'2.0.0'
options
[
:debugger
]
end
def
require_debugger
require
'debugger'
puts
"=> Debugger enabled"
rescue
LoadError
puts
"You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again."
exit
(
1
)
end
end
def
start
def
start
if
RUBY_VERSION
<
'2.0.0'
if
RUBY_VERSION
<
'2.0.0'
...
@@ -99,13 +109,5 @@ def start
...
@@ -99,13 +109,5 @@ def start
end
end
console
.
start
console
.
start
end
end
def
require_debugger
require
'debugger'
puts
"=> Debugger enabled"
rescue
LoadError
puts
"You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again."
exit
(
1
)
end
if
RUBY_VERSION
<
'2.0.0'
end
end
end
end
railties/test/commands/console_test.rb
浏览文件 @
6fae9ac5
...
@@ -19,14 +19,8 @@ def test_short_version_of_sandbox_option
...
@@ -19,14 +19,8 @@ def test_short_version_of_sandbox_option
assert
console
.
sandbox?
assert
console
.
sandbox?
end
end
def
test_debugger_option
console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([
"--debugger"
]))
assert
console
.
debugger?
end
if
RUBY_VERSION
<
'2.0.0'
def
test_no_options
def
test_no_options
console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([]))
console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([]))
assert
!
console
.
debugger?
if
RUBY_VERSION
<
'2.0.0'
assert
!
console
.
sandbox?
assert
!
console
.
sandbox?
end
end
...
@@ -36,13 +30,6 @@ def test_start
...
@@ -36,13 +30,6 @@ def test_start
assert_match
(
/Loading \w+ environment \(Rails/
,
output
)
assert_match
(
/Loading \w+ environment \(Rails/
,
output
)
end
end
def
test_start_with_debugger
rails_console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([
"--debugger"
]))
rails_console
.
expects
(
:require_debugger
).
returns
(
nil
)
silence_stream
(
STDOUT
)
{
rails_console
.
start
}
end
if
RUBY_VERSION
<
'2.0.0'
def
test_start_with_sandbox
def
test_start_with_sandbox
app
.
expects
(
:sandbox
=
).
with
(
true
)
app
.
expects
(
:sandbox
=
).
with
(
true
)
FakeConsole
.
expects
(
:start
)
FakeConsole
.
expects
(
:start
)
...
@@ -52,6 +39,25 @@ def test_start_with_sandbox
...
@@ -52,6 +39,25 @@ def test_start_with_sandbox
assert_match
(
/Loading \w+ environment in sandbox \(Rails/
,
output
)
assert_match
(
/Loading \w+ environment in sandbox \(Rails/
,
output
)
end
end
if
RUBY_VERSION
<
'2.0.0'
def
test_debugger_option
console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([
"--debugger"
]))
assert
console
.
debugger?
end
def
test_no_options_does_not_set_debugger_flag
console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([]))
assert
!
console
.
debugger?
end
def
test_start_with_debugger
rails_console
=
Rails
::
Console
.
new
(
app
,
parse_arguments
([
"--debugger"
]))
rails_console
.
expects
(
:require_debugger
).
returns
(
nil
)
silence_stream
(
STDOUT
)
{
rails_console
.
start
}
end
end
def
test_console_with_environment
def
test_console_with_environment
start
[
"-e production"
]
start
[
"-e production"
]
assert_match
(
/\sproduction\s/
,
output
)
assert_match
(
/\sproduction\s/
,
output
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录