Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9e486905
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,发现更多精彩内容 >>
提交
9e486905
编写于
11月 23, 2015
作者:
S
Sean Griffin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22380 from wjessop/fix_race_in_aj_integration_tests
Fix race condition testing for job execution order
上级
4547e894
171e788c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
7 deletion
+18
-7
activejob/test/integration/queuing_test.rb
activejob/test/integration/queuing_test.rb
+1
-1
activejob/test/support/integration/dummy_app_template.rb
activejob/test/support/integration/dummy_app_template.rb
+5
-2
activejob/test/support/integration/test_case_helpers.rb
activejob/test/support/integration/test_case_helpers.rb
+12
-4
未找到文件。
activejob/test/integration/queuing_test.rb
浏览文件 @
9e486905
...
...
@@ -78,7 +78,7 @@ class QueuingTest < ActiveSupport::TestCase
TestJob
.
perform_later
@id
wait_for_jobs_to_finish_for
(
5
.
seconds
)
assert
job_executed
assert_equal
'de'
,
job_
output
assert_equal
'de'
,
job_
executed_in_locale
ensure
I18n
.
available_locales
=
[
:en
]
I18n
.
locale
=
:en
...
...
activejob/test/support/integration/dummy_app_template.rb
浏览文件 @
9e486905
...
...
@@ -18,8 +18,11 @@ class TestJob < ActiveJob::Base
queue_as :integration_tests
def perform(x)
File.open(Rails.root.join("tmp/
\#
{x}"), "w+") do |f|
f.write I18n.locale
File.open(Rails.root.join("tmp/
\#
{x}"), "wb+") do |f|
f.write Marshal.dump({
"locale" => I18n.locale.to_s || "en",
"executed_at" => Time.now.to_r
})
end
end
end
...
...
activejob/test/support/integration/test_case_helpers.rb
浏览文件 @
9e486905
...
...
@@ -42,15 +42,23 @@ def wait_for_jobs_to_finish_for(seconds=60)
end
end
def
job_file
(
id
)
Dummy
::
Application
.
root
.
join
(
"tmp/
#{
id
}
"
)
end
def
job_executed
(
id
=
@id
)
Dummy
::
Application
.
root
.
join
(
"tmp/
#{
id
}
"
).
exist?
job_file
(
id
).
exist?
end
def
job_data
(
id
)
Marshal
.
load
(
File
.
binread
(
job_file
(
id
)))
end
def
job_executed_at
(
id
=
@id
)
File
.
new
(
Dummy
::
Application
.
root
.
join
(
"tmp/
#{
id
}
"
)).
ctime
job_data
(
id
)[
"executed_at"
]
end
def
job_
output
File
.
read
Dummy
::
Application
.
root
.
join
(
"tmp/
#{
@id
}
"
)
def
job_
executed_in_locale
(
id
=
@id
)
job_data
(
id
)[
"locale"
]
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录