提交 dd6efe98 编写于 作者: X Xavier Noria

Merge remote branch 'docrails/master'

...@@ -65,7 +65,8 @@ def escape_javascript(javascript) ...@@ -65,7 +65,8 @@ def escape_javascript(javascript)
# //]]> # //]]>
# </script> # </script>
# #
# +html_options+ may be a hash of attributes for the <script> tag. Example: # +html_options+ may be a hash of attributes for the <tt><script></tt>
# tag. Example:
# javascript_tag "alert('All is good')", :defer => 'defer' # javascript_tag "alert('All is good')", :defer => 'defer'
# # => <script defer="defer" type="text/javascript">alert('All is good')</script> # # => <script defer="defer" type="text/javascript">alert('All is good')</script>
# #
......
...@@ -161,8 +161,8 @@ def include_helpers_from_context ...@@ -161,8 +161,8 @@ def include_helpers_from_context
# JavaScriptGenerator generates blocks of JavaScript code that allow you # JavaScriptGenerator generates blocks of JavaScript code that allow you
# to change the content and presentation of multiple DOM elements. Use # to change the content and presentation of multiple DOM elements. Use
# this in your Ajax response bodies, either in a <script> tag or as plain # this in your Ajax response bodies, either in a <tt><script></tt> tag
# JavaScript sent with a Content-type of "text/javascript". # or as plain JavaScript sent with a Content-type of "text/javascript".
# #
# Create new instances with PrototypeHelper#update_page or with # Create new instances with PrototypeHelper#update_page or with
# ActionController::Base#render, then call +insert_html+, +replace_html+, # ActionController::Base#render, then call +insert_html+, +replace_html+,
...@@ -224,7 +224,7 @@ def include_helpers_from_context ...@@ -224,7 +224,7 @@ def include_helpers_from_context
# #
# You can also use PrototypeHelper#update_page_tag instead of # You can also use PrototypeHelper#update_page_tag instead of
# PrototypeHelper#update_page to wrap the generated JavaScript in a # PrototypeHelper#update_page to wrap the generated JavaScript in a
# <script> tag. # <tt><script></tt> tag.
module GeneratorMethods module GeneratorMethods
def to_s #:nodoc: def to_s #:nodoc:
(@lines * $/).tap do |javascript| (@lines * $/).tap do |javascript|
...@@ -582,12 +582,12 @@ def update_page(&block) ...@@ -582,12 +582,12 @@ def update_page(&block)
JavaScriptGenerator.new(self, &block).to_s.html_safe JavaScriptGenerator.new(self, &block).to_s.html_safe
end end
# Works like update_page but wraps the generated JavaScript in a <script> # Works like update_page but wraps the generated JavaScript in a
# tag. Use this to include generated JavaScript in an ERb template. # <tt><script></tt> tag. Use this to include generated JavaScript in an
# See JavaScriptGenerator for more information. # ERb template. See JavaScriptGenerator for more information.
# #
# +html_options+ may be a hash of <script> attributes to be passed # +html_options+ may be a hash of <tt><script></tt> attributes to be
# to ActionView::Helpers::JavaScriptHelper#javascript_tag. # passed to ActionView::Helpers::JavaScriptHelper#javascript_tag.
def update_page_tag(html_options = {}, &block) def update_page_tag(html_options = {}, &block)
javascript_tag update_page(&block), html_options javascript_tag update_page(&block), html_options
end end
......
...@@ -83,13 +83,13 @@ def initialize ...@@ -83,13 +83,13 @@ def initialize
super { |h,k| h[k] = [] } super { |h,k| h[k] = [] }
end end
# return a list of new constants found since the last call to watch_modules # return a list of new constants found since the last call to watch_namespaces
def new_constants def new_constants
constants = [] constants = []
# Grab the list of namespaces that we're looking for new constants under # Grab the list of namespaces that we're looking for new constants under
@watching.last.each do |namespace| @watching.last.each do |namespace|
# Retrieve the constants that were present under the namespace when watch_modules # Retrieve the constants that were present under the namespace when watch_namespaces
# was originally called # was originally called
original_constants = self[namespace].last original_constants = self[namespace].last
...@@ -115,7 +115,7 @@ def new_constants ...@@ -115,7 +115,7 @@ def new_constants
end end
constants constants
ensure ensure
# A call to new_constants is always called after a call to watch_modules # A call to new_constants is always called after a call to watch_namespaces
pop_modules(@watching.pop) pop_modules(@watching.pop)
end end
......
...@@ -241,8 +241,7 @@ h4. Running Tests ...@@ -241,8 +241,7 @@ h4. Running Tests
Running a test is as simple as invoking the file containing the test cases through Ruby: Running a test is as simple as invoking the file containing the test cases through Ruby:
<shell> <shell>
$ cd test $ ruby -Itest test/unit/post_test.rb
$ ruby unit/post_test.rb
Loaded suite unit/post_test Loaded suite unit/post_test
Started Started
...@@ -252,12 +251,12 @@ Finished in 0.023513 seconds. ...@@ -252,12 +251,12 @@ Finished in 0.023513 seconds.
1 tests, 1 assertions, 0 failures, 0 errors 1 tests, 1 assertions, 0 failures, 0 errors
</shell> </shell>
This will run all the test methods from the test case. This will run all the test methods from the test case. Note that +test_helper.rb+ is in the +test+ directory, hence this directory needs to be added to the load path using the +-I+ switch.
You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+. You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+.
<shell> <shell>
$ ruby unit/post_test.rb -n test_truth $ ruby -Itest test/unit/post_test.rb -n test_truth
Loaded suite unit/post_test Loaded suite unit/post_test
Started Started
......
<%= app_const %>.configure do <%= app_const %>.configure do
# Settings specified here will take precedence over those in config/environment.rb # Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
......
<%= app_const %>.configure do <%= app_const %>.configure do
# Settings specified here will take precedence over those in config/environment.rb # Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps. # The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests # Code is not reloaded between requests
......
<%= app_const %>.configure do <%= app_const %>.configure do
# Settings specified here will take precedence over those in config/environment.rb # Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册