Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
26b27503
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,发现更多精彩内容 >>
提交
26b27503
编写于
1月 27, 2015
作者:
M
Melanie Gilman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update option to skip test in generators
Rails no longer generates Test::Unit files by default.
上级
d66ffb65
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
24 addition
and
20 deletion
+24
-20
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/generators/app_base.rb
railties/lib/rails/generators/app_base.rb
+3
-3
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+1
-1
railties/lib/rails/generators/rails/app/templates/config/application.rb
...ails/generators/rails/app/templates/config/application.rb
+1
-1
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
...ies/lib/rails/generators/rails/plugin/plugin_generator.rb
+2
-2
railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec
...ib/rails/generators/rails/plugin/templates/%name%.gemspec
+1
-1
railties/lib/rails/generators/rails/plugin/templates/gitignore
...ies/lib/rails/generators/rails/plugin/templates/gitignore
+2
-2
railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
...ls/generators/rails/plugin/templates/rails/application.rb
+1
-1
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+4
-4
railties/test/generators/plugin_generator_test.rb
railties/test/generators/plugin_generator_test.rb
+4
-4
railties/test/generators/shared_generator_tests.rb
railties/test/generators/shared_generator_tests.rb
+1
-1
未找到文件。
railties/CHANGELOG.md
浏览文件 @
26b27503
*
Rename
`--skip-test-unit`
option to
`--skip-test`
in app generator
*Melanie Gilman*
*
Add the
`method_source`
gem to the default Gemfile for apps
*Sean Griffin*
...
...
railties/lib/rails/generators/app_base.rb
浏览文件 @
26b27503
...
...
@@ -69,8 +69,8 @@ def self.add_shared_options_for(name)
class_option
:skip_turbolinks
,
type: :boolean
,
default:
false
,
desc:
'Skip turbolinks gem'
class_option
:skip_test
_unit
,
type: :boolean
,
aliases:
'-T'
,
default:
false
,
desc:
'Skip
Test::Unit
files'
class_option
:skip_test
,
type: :boolean
,
aliases:
'-T'
,
default:
false
,
desc:
'Skip
ActiveSupport::TestCase
files'
class_option
:rc
,
type: :string
,
default:
false
,
desc:
"Path to file containing extra configuration options for rails command"
...
...
@@ -168,7 +168,7 @@ def database_gemfile_entry
end
def
include_all_railties?
options
.
values_at
(
:skip_active_record
,
:skip_action_mailer
,
:skip_test
_unit
,
:skip_sprockets
).
none?
options
.
values_at
(
:skip_active_record
,
:skip_action_mailer
,
:skip_test
,
:skip_sprockets
).
none?
end
def
comment_if
(
value
)
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
26b27503
...
...
@@ -234,7 +234,7 @@ def create_public_files
end
def
create_test_files
build
(
:test
)
unless
options
[
:skip_test
_unit
]
build
(
:test
)
unless
options
[
:skip_test
]
end
def
create_tmp_files
...
...
railties/lib/rails/generators/rails/app/templates/config/application.rb
浏览文件 @
26b27503
...
...
@@ -12,7 +12,7 @@
<%=
comment_if
:skip_action_mailer
%>
require
"action_mailer/railtie"
require
"action_view/railtie"
<
%= comment_if :skip_sprockets %>require "sprockets/railtie"
<%=
comment_if
:skip_test
_unit
%>
require
"rails/test_unit/railtie"
<%=
comment_if
:skip_test
%>
require
"rails/test_unit/railtie"
<
% end
-
%>
# Require the gems listed in Gemfile, including any gems
...
...
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
浏览文件 @
26b27503
...
...
@@ -226,7 +226,7 @@ def create_bin_files
end
def
create_test_files
build
(
:test
)
unless
options
[
:skip_test
_unit
]
build
(
:test
)
unless
options
[
:skip_test
]
end
def
create_test_dummy_files
...
...
@@ -294,7 +294,7 @@ def skip_git?
end
def
with_dummy_app?
options
[
:skip_test
_unit
].
blank?
||
options
[
:dummy_path
]
!=
'test/dummy'
options
[
:skip_test
].
blank?
||
options
[
:dummy_path
]
!=
'test/dummy'
end
def
self
.
banner
...
...
railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec
浏览文件 @
26b27503
...
...
@@ -15,7 +15,7 @@
s
.
license
=
"MIT"
s
.
files
=
Dir
[
"{app,config,db,lib}/**/*"
,
"MIT-LICENSE"
,
"Rakefile"
,
"README.rdoc"
]
<
% unless
options
.
skip_test
_unit
?
-
%>
<
% unless
options
.
skip_test?
-
%>
s.test_files = Dir["test/**/*"]
<% end -%>
...
...
railties/lib/rails/generators/rails/plugin/templates/gitignore
浏览文件 @
26b27503
.bundle/
log/*.log
pkg/
<% unless options[:skip_test
_unit
] && options[:dummy_path] == 'test/dummy' -%>
<% unless options[:skip_test] && options[:dummy_path] == 'test/dummy' -%>
<%= dummy_path %>/db/*.sqlite3
<%= dummy_path %>/db/*.sqlite3-journal
<%= dummy_path %>/log/*.log
<%= dummy_path %>/tmp/
<%= dummy_path %>/.sass-cache
<% end -%>
\ No newline at end of file
<% end -%>
railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
浏览文件 @
26b27503
...
...
@@ -9,7 +9,7 @@
<%=
comment_if
:skip_action_mailer
%>
require
"action_mailer/railtie"
require
"action_view/railtie"
<
%= comment_if :skip_sprockets %>require "sprockets/railtie"
<%=
comment_if
:skip_test
_unit
%>
require
"rails/test_unit/railtie"
<%=
comment_if
:skip_test
%>
require
"rails/test_unit/railtie"
<
% end
-
%>
Bundler.require(*Rails.groups)
...
...
railties/test/generators/app_generator_test.rb
浏览文件 @
26b27503
...
...
@@ -445,13 +445,13 @@ def test_file_is_added_for_backwards_compatibility
assert_file
'lib/test_file.rb'
,
'heres test data'
end
def
test_test
_unit_is_removed_from_frameworks_if_skip_test_uni
t_is_given
run_generator
[
destination_root
,
"--skip-test
-unit
"
]
def
test_test
s_are_removed_from_frameworks_if_skip_tes
t_is_given
run_generator
[
destination_root
,
"--skip-test"
]
assert_file
"config/application.rb"
,
/#\s+require\s+["']rails\/test_unit\/railtie["']/
end
def
test_no_active_record_or_test
_unit
_if_skips_given
run_generator
[
destination_root
,
"--skip-test
-unit
"
,
"--skip-active-record"
]
def
test_no_active_record_or_test
s
_if_skips_given
run_generator
[
destination_root
,
"--skip-test"
,
"--skip-active-record"
]
assert_file
"config/application.rb"
,
/#\s+require\s+["']rails\/test_unit\/railtie["']/
assert_file
"config/application.rb"
,
/#\s+require\s+["']active_record\/railtie["']/
assert_file
"config/application.rb"
,
/\s+require\s+["']active_job\/railtie["']/
...
...
railties/test/generators/plugin_generator_test.rb
浏览文件 @
26b27503
...
...
@@ -112,7 +112,7 @@ def test_ensure_that_plugin_options_are_not_passed_to_app_generator
def
test_ensure_that_test_dummy_can_be_generated_from_a_template
FileUtils
.
cd
(
Rails
.
root
)
run_generator
([
destination_root
,
"-m"
,
"lib/create_test_dummy_template.rb"
,
"--skip-test
-unit
"
])
run_generator
([
destination_root
,
"-m"
,
"lib/create_test_dummy_template.rb"
,
"--skip-test"
])
assert_file
"spec/dummy"
assert_no_file
"test"
end
...
...
@@ -321,7 +321,7 @@ def test_creating_dummy_application_with_different_name
end
def
test_creating_dummy_without_tests_but_with_dummy_path
run_generator
[
destination_root
,
"--dummy_path"
,
"spec/dummy"
,
"--skip-test
-unit
"
]
run_generator
[
destination_root
,
"--dummy_path"
,
"spec/dummy"
,
"--skip-test"
]
assert_file
"spec/dummy"
assert_file
"spec/dummy/config/application.rb"
assert_no_file
"test"
...
...
@@ -333,14 +333,14 @@ def test_creating_dummy_without_tests_but_with_dummy_path
def
test_ensure_that_gitignore_can_be_generated_from_a_template_for_dummy_path
FileUtils
.
cd
(
Rails
.
root
)
run_generator
([
destination_root
,
"--dummy_path"
,
"spec/dummy"
,
"--skip-test
-unit
"
])
run_generator
([
destination_root
,
"--dummy_path"
,
"spec/dummy"
,
"--skip-test"
])
assert_file
".gitignore"
do
|
contents
|
assert_match
(
/spec\/dummy/
,
contents
)
end
end
def
test_skipping_test_unit
run_generator
[
destination_root
,
"--skip-test
-unit
"
]
run_generator
[
destination_root
,
"--skip-test"
]
assert_no_file
"test"
assert_file
"bukkits.gemspec"
do
|
contents
|
assert_no_match
(
/s.test_files = Dir\["test\/\*\*\/\*"\]/
,
contents
)
...
...
railties/test/generators/shared_generator_tests.rb
浏览文件 @
26b27503
...
...
@@ -48,7 +48,7 @@ def test_invalid_database_option_raises_an_error
end
def
test_test_unit_is_skipped_if_required
run_generator
[
destination_root
,
"--skip-test
-unit
"
]
run_generator
[
destination_root
,
"--skip-test"
]
assert_no_file
"test"
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录