Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
44633dc7
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,发现更多精彩内容 >>
提交
44633dc7
编写于
7月 03, 2009
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some tests for no_color! behavior.
上级
21db0481
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
9 deletion
+16
-9
railties/lib/commands/destroy.rb
railties/lib/commands/destroy.rb
+1
-1
railties/lib/commands/generate.rb
railties/lib/commands/generate.rb
+1
-1
railties/lib/commands/update.rb
railties/lib/commands/update.rb
+1
-1
railties/lib/generators.rb
railties/lib/generators.rb
+2
-2
railties/test/generators_test.rb
railties/test/generators_test.rb
+11
-4
未找到文件。
railties/lib/commands/destroy.rb
浏览文件 @
44633dc7
...
...
@@ -7,4 +7,4 @@
end
name
=
ARGV
.
shift
Rails
::
Generators
.
invoke
name
,
ARGV
,
:revoke
Rails
::
Generators
.
invoke
name
,
ARGV
,
:
behavior
=>
:
revoke
railties/lib/commands/generate.rb
浏览文件 @
44633dc7
...
...
@@ -7,4 +7,4 @@
end
name
=
ARGV
.
shift
Rails
::
Generators
.
invoke
name
,
ARGV
,
:invoke
Rails
::
Generators
.
invoke
name
,
ARGV
,
:
behavior
=>
:
invoke
railties/lib/commands/update.rb
浏览文件 @
44633dc7
...
...
@@ -7,4 +7,4 @@
end
name
=
ARGV
.
shift
Rails
::
Generators
.
invoke
name
,
ARGV
,
:skip
Rails
::
Generators
.
invoke
name
,
ARGV
,
:
behavior
=>
:
skip
railties/lib/generators.rb
浏览文件 @
44633dc7
...
...
@@ -123,10 +123,10 @@ def self.help
# It's used as the default entry point for generate, destroy and update
# commands.
#
def
self
.
invoke
(
namespace
,
args
=
ARGV
,
behavior
=
:invoke
)
def
self
.
invoke
(
namespace
,
args
=
ARGV
,
config
=
{}
)
if
klass
=
find_by_namespace
(
namespace
,
"rails"
)
args
<<
"--help"
if
klass
.
arguments
.
any?
{
|
a
|
a
.
required?
}
&&
args
.
empty?
klass
.
start
args
,
:behavior
=>
behavior
klass
.
start
args
,
config
else
puts
"Could not find generator
#{
namespace
}
."
end
...
...
railties/test/generators_test.rb
浏览文件 @
44633dc7
...
...
@@ -13,14 +13,14 @@ def test_help_when_a_generator_with_required_arguments_is_invoked_without_argume
assert_match
/Description:/
,
output
end
def
test_invoke_with_default_
behavior
Rails
::
Generators
::
ModelGenerator
.
expects
(
:start
).
with
([
"Account"
],
:behavior
=>
:invoke
)
def
test_invoke_with_default_
values
Rails
::
Generators
::
ModelGenerator
.
expects
(
:start
).
with
([
"Account"
],
{}
)
Rails
::
Generators
.
invoke
:model
,
[
"Account"
]
end
def
test_invoke_with_
given_behavior
def
test_invoke_with_
config_values
Rails
::
Generators
::
ModelGenerator
.
expects
(
:start
).
with
([
"Account"
],
:behavior
=>
:skip
)
Rails
::
Generators
.
invoke
:model
,
[
"Account"
],
:skip
Rails
::
Generators
.
invoke
:model
,
[
"Account"
],
:
behavior
=>
:
skip
end
def
test_find_by_namespace_without_base_or_context
...
...
@@ -77,4 +77,11 @@ def test_rails_generators_with_others_information
output
=
capture
(
:stdout
){
Rails
::
Generators
.
help
}.
split
(
"
\n
"
).
last
assert_equal
"Others: active_record:fixjour, fixjour, rails:javascripts."
,
output
end
def
test_no_color_sets_proper_shell
Rails
::
Generators
.
no_color!
assert_equal
Thor
::
Shell
::
Basic
,
Thor
::
Base
.
shell
ensure
Thor
::
Base
.
shell
=
Thor
::
Shell
::
Color
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录