Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
0eb2d607
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,发现更多精彩内容 >>
未验证
提交
0eb2d607
编写于
9月 14, 2017
作者:
B
bogdanvlviv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Invoke rails command inside the railties' test app with TestHelpers::Generation#rails
See #30520
上级
ff67743f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
16 deletion
+12
-16
railties/test/application/loading_test.rb
railties/test/application/loading_test.rb
+2
-2
railties/test/application/rake_test.rb
railties/test/application/rake_test.rb
+9
-13
railties/test/application/server_test.rb
railties/test/application/server_test.rb
+1
-1
未找到文件。
railties/test/application/loading_test.rb
浏览文件 @
0eb2d607
...
...
@@ -300,7 +300,7 @@ def change
end
MIGRATION
Dir
.
chdir
(
app_path
)
{
`rake db:migrate`
}
rails
(
"db:migrate"
)
require
"
#{
rails_root
}
/config/environment"
get
"/title"
...
...
@@ -314,7 +314,7 @@ def change
end
MIGRATION
Dir
.
chdir
(
app_path
)
{
`rake db:migrate`
}
rails
(
"db:migrate"
)
get
"/body"
assert_equal
"BODY"
,
last_response
.
body
...
...
railties/test/application/rake_test.rb
浏览文件 @
0eb2d607
...
...
@@ -101,6 +101,7 @@ def test_should_not_eager_load_model_for_rake
add_to_config
<<-
RUBY
rake_tasks do
task do_nothing: :environment do
puts 'There is nothing'
end
end
RUBY
...
...
@@ -113,10 +114,8 @@ def test_should_not_eager_load_model_for_rake
raise 'should not be pre-required for rake even eager_load=true'
RUBY
Dir
.
chdir
(
app_path
)
do
assert
system
(
"bin/rails do_nothing RAILS_ENV=production"
),
"should not be pre-required for rake even eager_load=true"
end
output
=
rails
(
"do_nothing"
,
"RAILS_ENV=production"
)
assert_match
"There is nothing"
,
output
end
def
test_code_statistics_sanity
...
...
@@ -294,9 +293,8 @@ def test_loading_only_yml_fixtures
def
test_scaffold_tests_pass_by_default
rails
"generate"
,
"scaffold"
,
"user"
,
"username:string"
,
"password:string"
output
=
Dir
.
chdir
(
app_path
)
do
`RAILS_ENV=test bin/rails db:migrate test`
end
with_rails_env
(
"test"
)
{
rails
(
"db:migrate"
)
}
output
=
rails
(
"test"
)
assert_match
(
/7 runs, 9 assertions, 0 failures, 0 errors/
,
output
)
assert_no_match
(
/Errors running/
,
output
)
...
...
@@ -313,9 +311,8 @@ class ApplicationController < ActionController::API
RUBY
rails
"generate"
,
"scaffold"
,
"user"
,
"username:string"
,
"password:string"
output
=
Dir
.
chdir
(
app_path
)
do
`RAILS_ENV=test bin/rails db:migrate test`
end
with_rails_env
(
"test"
)
{
rails
(
"db:migrate"
)
}
output
=
rails
(
"test"
)
assert_match
(
/5 runs, 7 assertions, 0 failures, 0 errors/
,
output
)
assert_no_match
(
/Errors running/
,
output
)
...
...
@@ -325,9 +322,8 @@ def test_scaffold_with_references_columns_tests_pass_by_default
rails
"generate"
,
"model"
,
"Product"
rails
"generate"
,
"model"
,
"Cart"
rails
"generate"
,
"scaffold"
,
"LineItems"
,
"product:references"
,
"cart:belongs_to"
output
=
Dir
.
chdir
(
app_path
)
do
`RAILS_ENV=test bin/rails db:migrate test`
end
with_rails_env
(
"test"
)
{
rails
(
"db:migrate"
)
}
output
=
rails
(
"test"
)
assert_match
(
/7 runs, 9 assertions, 0 failures, 0 errors/
,
output
)
assert_no_match
(
/Errors running/
,
output
)
...
...
railties/test/application/server_test.rb
浏览文件 @
0eb2d607
...
...
@@ -42,7 +42,7 @@ def teardown
pid
=
Process
.
spawn
(
"
#{
app_path
}
/bin/rails server -P tmp/dummy.pid"
,
in:
slave
,
out:
slave
,
err:
slave
)
assert_output
(
"Listening"
,
master
)
Dir
.
chdir
(
app_path
)
{
system
(
"bin/rails restart"
)
}
rails
(
"restart"
)
assert_output
(
"Restarting"
,
master
)
assert_output
(
"Inherited"
,
master
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录