Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
2ebea1c0
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,发现更多精彩内容 >>
提交
2ebea1c0
编写于
1月 31, 2010
作者:
M
Mikel Lindsaar
提交者:
Jeremy Kemper
1月 31, 2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
deOMGifying Railties, Active Support, and Action Pack
上级
b3a02825
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
65 addition
and
66 deletion
+65
-66
actionpack/lib/action_controller/metal/testing.rb
actionpack/lib/action_controller/metal/testing.rb
+1
-1
actionpack/lib/action_view/template/resolver.rb
actionpack/lib/action_view/template/resolver.rb
+1
-2
actionpack/test/abstract/layouts_test.rb
actionpack/test/abstract/layouts_test.rb
+9
-9
actionpack/test/controller/filters_test.rb
actionpack/test/controller/filters_test.rb
+3
-3
actionpack/test/controller/new_base/render_action_test.rb
actionpack/test/controller/new_base/render_action_test.rb
+14
-14
actionpack/test/controller/new_base/render_layout_test.rb
actionpack/test/controller/new_base/render_layout_test.rb
+10
-10
actionpack/test/controller/new_base/render_partial_test.rb
actionpack/test/controller/new_base/render_partial_test.rb
+2
-2
actionpack/test/controller/subscriber_test.rb
actionpack/test/controller/subscriber_test.rb
+2
-2
actionpack/test/dispatch/mime_type_test.rb
actionpack/test/dispatch/mime_type_test.rb
+2
-2
actionpack/test/template/html-scanner/sanitizer_test.rb
actionpack/test/template/html-scanner/sanitizer_test.rb
+2
-2
actionpack/test/template/subscriber_test.rb
actionpack/test/template/subscriber_test.rb
+2
-2
activesupport/test/callbacks_test.rb
activesupport/test/callbacks_test.rb
+4
-4
activesupport/test/fixtures/custom.rb
activesupport/test/fixtures/custom.rb
+2
-0
activesupport/test/fixtures/omgomg.rb
activesupport/test/fixtures/omgomg.rb
+0
-2
activesupport/test/isolation_test.rb
activesupport/test/isolation_test.rb
+6
-6
activesupport/test/notifications_test.rb
activesupport/test/notifications_test.rb
+3
-3
railties/guides/source/rails_application_templates.textile
railties/guides/source/rails_application_templates.textile
+1
-1
railties/test/initializable_test.rb
railties/test/initializable_test.rb
+1
-1
未找到文件。
actionpack/lib/action_controller/metal/testing.rb
浏览文件 @
2ebea1c0
...
...
@@ -4,7 +4,7 @@ module Testing
include
RackDelegation
#
OMG MEGA HAX
#
TODO: Clean this up
def
process_with_new_base_test
(
request
,
response
)
@_request
=
request
@_response
=
response
...
...
actionpack/lib/action_view/template/resolver.rb
浏览文件 @
2ebea1c0
...
...
@@ -141,8 +141,7 @@ def initialize(path, options = {})
end
end
# OMG HAX
# TODO: remove hax
# TODO: remove hack
class
FileSystemResolverWithFallback
<
Resolver
def
initialize
(
path
,
options
=
{})
super
(
options
)
...
...
actionpack/test/abstract/layouts_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -13,7 +13,7 @@ class Base < AbstractController::Base
"layouts/hello_override.erb"
=>
"With Override <%= yield %>"
,
"layouts/abstract_controller_tests/layouts/with_string_implied_child.erb"
=>
"With Implied <%= yield %>"
,
"layouts/o
mg.erb"
=>
"OMGHI2U
<%= yield %>"
,
"layouts/o
verwrite.erb"
=>
"Overwrite
<%= yield %>"
,
"layouts/with_false_layout.erb"
=>
"False Layout <%= yield %>"
)]
end
...
...
@@ -42,7 +42,7 @@ def overwrite_false
end
def
overwrite_string
render
:_template
=>
ActionView
::
Template
::
Text
.
new
(
"Hello string!"
),
:layout
=>
"o
mg
"
render
:_template
=>
ActionView
::
Template
::
Text
.
new
(
"Hello string!"
),
:layout
=>
"o
verwrite
"
end
def
overwrite_skip
...
...
@@ -68,7 +68,7 @@ class WithChildOfImplied < WithStringImpliedChild
end
class
WithProc
<
Base
layout
proc
{
|
c
|
"o
mg
"
}
layout
proc
{
|
c
|
"o
verwrite
"
}
def
index
render
:_template
=>
ActionView
::
Template
::
Text
.
new
(
"Hello proc!"
)
...
...
@@ -83,7 +83,7 @@ def index
end
private
def
hello
"o
mg
"
"o
verwrite
"
end
end
...
...
@@ -122,7 +122,7 @@ def objekt
end
class
WithSymbolAndNoMethod
<
Base
layout
:
omg_
no_method
layout
:no_method
def
index
render
:_template
=>
ActionView
::
Template
::
Text
.
new
(
"Hello boom!"
)
...
...
@@ -175,7 +175,7 @@ class TestBase < ActiveSupport::TestCase
test
"when layout is overwriten by string in render, render new layout"
do
controller
=
WithString
.
new
controller
.
process
(
:overwrite_string
)
assert_equal
"O
MGHI2U
Hello string!"
,
controller
.
response_body
assert_equal
"O
verwrite
Hello string!"
,
controller
.
response_body
end
test
"when layout is overwriten by false in render, render no layout"
do
...
...
@@ -209,13 +209,13 @@ class TestBase < ActiveSupport::TestCase
test
"when layout is specified as a proc, call it and use the layout returned"
do
controller
=
WithProc
.
new
controller
.
process
(
:index
)
assert_equal
"O
MGHI2U
Hello proc!"
,
controller
.
response_body
assert_equal
"O
verwrite
Hello proc!"
,
controller
.
response_body
end
test
"when layout is specified as a symbol, call the requested method and use the layout returned"
do
controller
=
WithSymbol
.
new
controller
.
process
(
:index
)
assert_equal
"O
MGHI2U
Hello symbol!"
,
controller
.
response_body
assert_equal
"O
verwrite
Hello symbol!"
,
controller
.
response_body
end
test
"when layout is specified as a symbol and the method returns nil, don't use a layout"
do
...
...
@@ -266,7 +266,7 @@ class TestBase < ActiveSupport::TestCase
test
"raises an exception when specifying layout true"
do
assert_raises
ArgumentError
do
Object
.
class_eval
do
class
::
Bad
OmgFailLo
lLayout
<
AbstractControllerTests
::
Layouts
::
Base
class
::
Bad
Fai
lLayout
<
AbstractControllerTests
::
Layouts
::
Base
layout
true
end
end
...
...
actionpack/test/controller/filters_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -435,7 +435,7 @@ def filter_two
end
def
non_yielding_filter
@filters
<<
"
zomg
it didn't yield"
@filters
<<
"it didn't yield"
@filter_return_value
end
...
...
@@ -465,14 +465,14 @@ def test_after_filters_are_not_run_if_around_filter_returns_false
controller
=
NonYieldingAroundFilterController
.
new
controller
.
instance_variable_set
"@filter_return_value"
,
false
test_process
(
controller
,
"index"
)
assert_equal
[
"filter_one"
,
"
zomg
it didn't yield"
],
controller
.
assigns
[
'filters'
]
assert_equal
[
"filter_one"
,
"it didn't yield"
],
controller
.
assigns
[
'filters'
]
end
def
test_after_filters_are_not_run_if_around_filter_does_not_yield
controller
=
NonYieldingAroundFilterController
.
new
controller
.
instance_variable_set
"@filter_return_value"
,
true
test_process
(
controller
,
"index"
)
assert_equal
[
"filter_one"
,
"
zomg
it didn't yield"
],
controller
.
assigns
[
'filters'
]
assert_equal
[
"filter_one"
,
"it didn't yield"
],
controller
.
assigns
[
'filters'
]
end
def
test_added_filter_to_inheritance_graph
...
...
actionpack/test/controller/new_base/render_action_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -119,9 +119,9 @@ class BasicController < ::ApplicationController
# Set the view path to an application view structure with layouts
self
.
view_paths
=
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"render_action_with_application_layout/basic/hello_world.html.erb"
=>
"Hello World!"
,
"render_action_with_application_layout/basic/hello.html.builder"
=>
"xml.p '
Omg
'"
,
"layouts/application.html.erb"
=>
"
OHAI <%= yield %> KTHXBAI
"
,
"layouts/greetings.html.erb"
=>
"Greetings <%= yield %> B
ai
"
,
"render_action_with_application_layout/basic/hello.html.builder"
=>
"xml.p '
Hello
'"
,
"layouts/application.html.erb"
=>
"
Hi <%= yield %> OK, Bye
"
,
"layouts/greetings.html.erb"
=>
"Greetings <%= yield %> B
ye
"
,
"layouts/builder.html.builder"
=>
"xml.html do
\n
xml << yield
\n
end"
)]
...
...
@@ -156,14 +156,14 @@ class LayoutTest < Rack::TestCase
test
"rendering implicit application.html.erb as layout"
do
get
"/render_action_with_application_layout/basic/hello_world"
assert_body
"
OHAI Hello World! KTHXBAI
"
assert_body
"
Hi Hello World! OK, Bye
"
assert_status
200
end
test
"rendering with layout => true"
do
get
"/render_action_with_application_layout/basic/hello_world_with_layout"
assert_body
"
OHAI Hello World! KTHXBAI
"
assert_body
"
Hi Hello World! OK, Bye
"
assert_status
200
end
...
...
@@ -184,7 +184,7 @@ class LayoutTest < Rack::TestCase
test
"rendering with layout => 'greetings'"
do
get
"/render_action_with_application_layout/basic/hello_world_with_custom_layout"
assert_body
"Greetings Hello World! B
ai
"
assert_body
"Greetings Hello World! B
ye
"
assert_status
200
end
end
...
...
@@ -194,7 +194,7 @@ class TestLayout < Rack::TestCase
test
"builder works with layouts"
do
get
:with_builder_and_layout
assert_response
"<html>
\n
<p>
Omg
</p>
\n
</html>
\n
"
assert_response
"<html>
\n
<p>
Hello
</p>
\n
</html>
\n
"
end
end
...
...
@@ -204,7 +204,7 @@ module RenderActionWithControllerLayout
class
BasicController
<
ActionController
::
Base
self
.
view_paths
=
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"render_action_with_controller_layout/basic/hello_world.html.erb"
=>
"Hello World!"
,
"layouts/render_action_with_controller_layout/basic.html.erb"
=>
"With Controller Layout! <%= yield %>
KTHXBAI
"
"layouts/render_action_with_controller_layout/basic.html.erb"
=>
"With Controller Layout! <%= yield %>
Bye
"
)]
def
hello_world
...
...
@@ -234,14 +234,14 @@ class ControllerLayoutTest < Rack::TestCase
test
"render hello_world and implicitly use <controller_path>.html.erb as a layout."
do
get
"/render_action_with_controller_layout/basic/hello_world"
assert_body
"With Controller Layout! Hello World!
KTHXBAI
"
assert_body
"With Controller Layout! Hello World!
Bye
"
assert_status
200
end
test
"rendering with layout => true"
do
get
"/render_action_with_controller_layout/basic/hello_world_with_layout"
assert_body
"With Controller Layout! Hello World!
KTHXBAI
"
assert_body
"With Controller Layout! Hello World!
Bye
"
assert_status
200
end
...
...
@@ -265,8 +265,8 @@ module RenderActionWithBothLayouts
class
BasicController
<
ActionController
::
Base
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
({
"render_action_with_both_layouts/basic/hello_world.html.erb"
=>
"Hello World!"
,
"layouts/application.html.erb"
=>
"O
HAI <%= yield %> KTHXBAI
"
,
"layouts/render_action_with_both_layouts/basic.html.erb"
=>
"With Controller Layout! <%= yield %>
KTHXBAI
"
"layouts/application.html.erb"
=>
"O
h Hi <%= yield %> Bye
"
,
"layouts/render_action_with_both_layouts/basic.html.erb"
=>
"With Controller Layout! <%= yield %>
Bye
"
})]
def
hello_world
...
...
@@ -292,14 +292,14 @@ class ControllerLayoutTest < Rack::TestCase
test
"rendering implicitly use <controller_path>.html.erb over application.html.erb as a layout"
do
get
"/render_action_with_both_layouts/basic/hello_world"
assert_body
"With Controller Layout! Hello World!
KTHXBAI
"
assert_body
"With Controller Layout! Hello World!
Bye
"
assert_status
200
end
test
"rendering with layout => true"
do
get
"/render_action_with_both_layouts/basic/hello_world_with_layout"
assert_body
"With Controller Layout! Hello World!
KTHXBAI
"
assert_body
"With Controller Layout! Hello World!
Bye
"
assert_status
200
end
...
...
actionpack/test/controller/new_base/render_layout_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -3,10 +3,10 @@
module
ControllerLayouts
class
ImplicitController
<
::
ApplicationController
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"layouts/application.html.erb"
=>
"
OMG <%= yield %> KTHXBAI
"
,
"layouts/application.html.erb"
=>
"
Main <%= yield %> Layout
"
,
"layouts/override.html.erb"
=>
"Override! <%= yield %>"
,
"basic.html.erb"
=>
"Hello world!"
,
"controller_layouts/implicit/layout_false.html.erb"
=>
"h
a
i(layout_false.html.erb)"
"controller_layouts/implicit/layout_false.html.erb"
=>
"hi(layout_false.html.erb)"
)]
def
index
...
...
@@ -27,7 +27,7 @@ def builder_override
class
ImplicitNameController
<
::
ApplicationController
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"layouts/controller_layouts/implicit_name.html.erb"
=>
"
OMGIMPLICIT <%= yield %> KTHXBAI
"
,
"layouts/controller_layouts/implicit_name.html.erb"
=>
"
Implicit <%= yield %> Layout
"
,
"basic.html.erb"
=>
"Hello world!"
)]
...
...
@@ -40,14 +40,14 @@ class RenderLayoutTest < Rack::TestCase
test
"rendering a normal template, but using the implicit layout"
do
get
"/controller_layouts/implicit/index"
assert_body
"
OMG Hello world! KTHXBAI
"
assert_body
"
Main Hello world! Layout
"
assert_status
200
end
test
"rendering a normal template, but using an implicit NAMED layout"
do
get
"/controller_layouts/implicit_name/index"
assert_body
"
OMGIMPLICIT Hello world! KTHXBAI
"
assert_body
"
Implicit Hello world! Layout
"
assert_status
200
end
...
...
@@ -63,15 +63,15 @@ class LayoutOptionsTest < Rack::TestCase
test
"rendering with :layout => false leaves out the implicit layout"
do
get
:layout_false
assert_response
"h
a
i(layout_false.html.erb)"
assert_response
"hi(layout_false.html.erb)"
end
end
class
MismatchFormatController
<
::
ApplicationController
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"layouts/application.html.erb"
=>
"<html><%= yield %></html>"
,
"controller_layouts/mismatch_format/index.js.rjs"
=>
"page[:test].
omg
"
,
"controller_layouts/mismatch_format/implicit.rjs"
=>
"page[:test].
omg
"
"controller_layouts/mismatch_format/index.js.rjs"
=>
"page[:test].
ext
"
,
"controller_layouts/mismatch_format/implicit.rjs"
=>
"page[:test].
ext
"
)]
def
explicit
...
...
@@ -84,12 +84,12 @@ class MismatchFormatTest < Rack::TestCase
test
"if JS is selected, an HTML template is not also selected"
do
get
:index
,
"format"
=>
"js"
assert_response
"$(
\"
test
\"
).
omg
();"
assert_response
"$(
\"
test
\"
).
ext
();"
end
test
"if JS is implicitly selected, an HTML template is not also selected"
do
get
:implicit
assert_response
"$(
\"
test
\"
).
omg
();"
assert_response
"$(
\"
test
\"
).
ext
();"
end
test
"if an HTML template is explicitly provides for a JS template, an error is raised"
do
...
...
actionpack/test/controller/new_base/render_partial_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -5,7 +5,7 @@ module RenderPartial
class
BasicController
<
ActionController
::
Base
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"render_partial/basic/_basic.html.erb"
=>
"
OMG
!"
,
"render_partial/basic/_basic.html.erb"
=>
"
BasicPartial
!"
,
"render_partial/basic/basic.html.erb"
=>
"<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>"
)]
...
...
@@ -20,7 +20,7 @@ class TestPartial < Rack::TestCase
test
"rendering a partial in ActionView doesn't pull the ivars again from the controller"
do
get
:changing
assert_response
(
"goodbye
OMG
!goodbye"
)
assert_response
(
"goodbye
BasicPartial
!goodbye"
)
end
end
...
...
actionpack/test/controller/subscriber_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -13,7 +13,7 @@ def redirector
end
def
data_sender
send_data
"cool data"
,
:filename
=>
"
omg
.txt"
send_data
"cool data"
,
:filename
=>
"
file
.txt"
end
def
xfile_sender
...
...
@@ -121,7 +121,7 @@ def test_send_data
wait
assert_equal
3
,
logs
.
size
assert_match
/Sent data
omg
\.txt/
,
logs
[
1
]
assert_match
/Sent data
file
\.txt/
,
logs
[
1
]
end
def
test_send_file
...
...
actionpack/test/dispatch/mime_type_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -23,7 +23,7 @@ class MimeTypeTest < ActiveSupport::TestCase
end
# Accept header send with user HTTP_USER_AGENT: Sunrise/0.42j (Windows XP)
test
"parse
crappy
broken acceptlines"
do
test
"parse broken acceptlines"
do
accept
=
"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/*,,*/*;q=0.5"
expect
=
[
Mime
::
HTML
,
Mime
::
XML
,
"image/*"
,
Mime
::
TEXT
,
Mime
::
ALL
]
assert_equal
expect
,
Mime
::
Type
.
parse
(
accept
).
collect
{
|
c
|
c
.
to_s
}
...
...
@@ -31,7 +31,7 @@ class MimeTypeTest < ActiveSupport::TestCase
# Accept header send with user HTTP_USER_AGENT: Mozilla/4.0
# (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
test
"parse
crappy broken acceptlines2
"
do
test
"parse
other broken acceptlines
"
do
accept
=
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, , pronto/1.00.00, sslvpn/1.00.00.00, */*"
expect
=
[
'image/gif'
,
'image/x-xbitmap'
,
'image/jpeg'
,
'image/pjpeg'
,
'application/x-shockwave-flash'
,
'application/vnd.ms-excel'
,
'application/vnd.ms-powerpoint'
,
'application/msword'
,
'pronto/1.00.00'
,
'sslvpn/1.00.00.00'
,
Mime
::
ALL
]
assert_equal
expect
,
Mime
::
Type
.
parse
(
accept
).
collect
{
|
c
|
c
.
to_s
}
...
...
actionpack/test/template/html-scanner/sanitizer_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -48,7 +48,7 @@ def test_sanitize_script
assert_sanitized
"a b c<script language=
\"
Javascript
\"
>blah blah blah</script>d e f"
,
"a b cd e f"
end
#
fucked
#
TODO: Clean up
def
test_sanitize_js_handlers
raw
=
%{onthis="do that" <a href="#" onclick="hello" name="foo" onbogus="remove me">hello</a>}
assert_sanitized
raw
,
%{onthis="do that" <a name="foo" href="#">hello</a>}
...
...
@@ -193,7 +193,7 @@ def test_should_not_fall_for_ridiculous_hack
assert_sanitized
img_hack
,
"<img>"
end
#
fucked
#
TODO: Clean up
def
test_should_sanitize_attributes
assert_sanitized
%(<SPAN title="'><script>alert()</script>">blah</SPAN>)
,
%(<span title="'><script>alert()</script>">blah</span>)
end
...
...
actionpack/test/template/subscriber_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -33,7 +33,7 @@ def test_render_file_template
end
def
test_render_text_template
@view
.
render
(
:text
=>
"
OMG
"
)
@view
.
render
(
:text
=>
"
TEXT
"
)
wait
assert_equal
1
,
@logger
.
logged
(
:info
).
size
...
...
@@ -41,7 +41,7 @@ def test_render_text_template
end
def
test_render_inline_template
@view
.
render
(
:inline
=>
"<%= '
OMG
' %>"
)
@view
.
render
(
:inline
=>
"<%= '
TEXT
' %>"
)
wait
assert_equal
1
,
@logger
.
logged
(
:info
).
size
...
...
activesupport/test/callbacks_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -264,12 +264,12 @@ class HyphenatedCallbacks
define_callbacks
:save
attr_reader
:stuff
set_callback
:save
,
:before
,
:
omg
,
:per_key
=>
{
:if
=>
:yes
}
set_callback
:save
,
:before
,
:
action
,
:per_key
=>
{
:if
=>
:yes
}
def
yes
()
true
end
def
omg
@stuff
=
"
OMG
"
def
action
@stuff
=
"
ACTION
"
end
def
save
...
...
@@ -522,7 +522,7 @@ class HyphenatedKeyTest < Test::Unit::TestCase
def
test_save
obj
=
HyphenatedCallbacks
.
new
obj
.
save
assert_equal
obj
.
stuff
,
"
OMG
"
assert_equal
obj
.
stuff
,
"
ACTION
"
end
end
end
activesupport/test/fixtures/custom.rb
0 → 100644
浏览文件 @
2ebea1c0
class
Custom
end
\ No newline at end of file
activesupport/test/fixtures/omgomg.rb
已删除
100644 → 0
浏览文件 @
b3a02825
class
OmgOmg
end
\ No newline at end of file
activesupport/test/isolation_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -59,15 +59,15 @@ def teardown
end
test
"resets requires one"
do
assert
!
defined?
(
OmgOmg
)
assert_equal
0
,
$LOADED_FEATURES
.
grep
(
/fixtures\/
omgomg
/
).
size
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"
omgomg
"
))
assert
!
defined?
(
Custom
)
assert_equal
0
,
$LOADED_FEATURES
.
grep
(
/fixtures\/
custom
/
).
size
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"
custom
"
))
end
test
"resets requires two"
do
assert
!
defined?
(
OmgOmg
)
assert_equal
0
,
$LOADED_FEATURES
.
grep
(
/fixtures\/
omgomg
/
).
size
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"
omgomg
"
))
assert
!
defined?
(
Custom
)
assert_equal
0
,
$LOADED_FEATURES
.
grep
(
/fixtures\/
custom
/
).
size
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"
custom
"
))
end
end
else
...
...
activesupport/test/notifications_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -77,7 +77,7 @@ def test_instrument_returns_block_result
def
test_instrument_with_bang_returns_result_even_on_failure
begin
instrument!
(
:awesome
,
:payload
=>
"notifications"
)
do
raise
"
OMG
"
raise
"
FAIL
"
end
flunk
rescue
...
...
@@ -126,10 +126,10 @@ def test_nested_events_can_be_instrumented
def
test_instrument_does_not_publish_when_exception_is_raised
begin
instrument
(
:awesome
,
:payload
=>
"notifications"
)
do
raise
"
OMG
"
raise
"
FAIL
"
end
rescue
RuntimeError
=>
e
assert_equal
"
OMG
"
,
e
.
message
assert_equal
"
FAIL
"
,
e
.
message
end
drain
...
...
railties/guides/source/rails_application_templates.textile
浏览文件 @
2ebea1c0
...
...
@@ -88,7 +88,7 @@ Please note that you need to +git :init+ before you can install a plugin as a su
Or use plain old SVN :
<ruby>
plugin '
wtfsvn', :svn => 'svn://crap.com/wtf
/trunk'
plugin '
usingsvn', :svn => 'svn://example.com/usingsvn
/trunk'
</ruby>
h4. vendor/lib/file/initializer(filename, data = nil, &block)
...
...
railties/test/initializable_test.rb
浏览文件 @
2ebea1c0
...
...
@@ -10,7 +10,7 @@ class << self
attr_accessor
:foo
,
:bar
end
initializer
:
omg
do
initializer
:
start
do
@foo
||=
0
@foo
+=
1
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录