From b680d153d26fbe38b16b10b33c945d5968e535e7 Mon Sep 17 00:00:00 2001 From: Mark Hayes Date: Thu, 12 Aug 2010 12:52:17 -0700 Subject: in Rendering objects with RecordIdentifier example, locals should reference @account not @buyer --- actionpack/lib/action_view/render/partials.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 459aae94a2..92cdbfb3af 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -56,7 +56,7 @@ module ActionView # you're following its conventions for RecordIdentifier#partial_path. Examples: # # # @account is an Account instance, so it uses the RecordIdentifier to replace - # # <%= render :partial => "accounts/account", :locals => { :account => @buyer } %> + # # <%= render :partial => "accounts/account", :locals => { :account => @account} %> # <%= render :partial => @account %> # # # @posts is an array of Post instances, so it uses the RecordIdentifier to replace -- cgit v1.2.3 From 17a6dfb745d98fcecc3a2af740fee8d7ef27a019 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Aug 2010 13:32:00 -0700 Subject: It's snowing! --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 2 +- actionpack/test/template/form_helper_test.rb | 2 +- actionpack/test/template/form_tag_helper_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index c1c5db0302..686c5b7a14 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -538,7 +538,7 @@ module ActionView def extra_tags_for_form(html_options) snowman_tag = tag(:input, :type => "hidden", - :name => "utf8", :value => "✓".html_safe) + :name => "_utf8", :value => "☃".html_safe) method = html_options.delete("method").to_s diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 71a5ae0245..4c81e691b2 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -1513,7 +1513,7 @@ class FormHelperTest < ActionView::TestCase def snowman(method = nil) txt = %{
} - txt << %{} + txt << %{} txt << %{} if method txt << %{
} end diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 532f086d21..d2f725a994 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -12,7 +12,7 @@ class FormTagHelperTest < ActionView::TestCase method = options[:method] txt = %{
} - txt << %{} + txt << %{} txt << %{} if method txt << %{
} end -- cgit v1.2.3 From 4c2bbe9a1abfefacda71764ad583c0a302b1fc4e Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 13 Aug 2010 17:34:20 -0300 Subject: Moves local_request? to require.local? [#5361 state:committed] --- actionpack/lib/action_dispatch/http/request.rb | 7 +++++++ actionpack/lib/action_dispatch/middleware/show_exceptions.rb | 9 +-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index fd23b1df79..5606d6abfe 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -15,6 +15,8 @@ module ActionDispatch include ActionDispatch::Http::Upload include ActionDispatch::Http::URL + LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze + %w[ AUTH_TYPE GATEWAY_INTERFACE PATH_TRANSLATED REMOTE_HOST REMOTE_IDENT REMOTE_USER REMOTE_ADDR @@ -231,5 +233,10 @@ module ActionDispatch @env['X_HTTP_AUTHORIZATION'] || @env['REDIRECT_X_HTTP_AUTHORIZATION'] end + + # True if the request came from localhost, 127.0.0.1. + def local? + LOCALHOST.any? { |local_ip| local_ip === remote_addr && local_ip === remote_ip } + end end end diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index e095b51342..a7d3cb473f 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -6,8 +6,6 @@ module ActionDispatch # This middleware rescues any exception returned by the application and renders # nice exception pages if it's being rescued locally. class ShowExceptions - LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze - RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates') cattr_accessor :rescue_responses @@ -66,7 +64,7 @@ module ActionDispatch log_error(exception) request = Request.new(env) - if @consider_all_requests_local || local_request?(request) + if @consider_all_requests_local || request.local? rescue_action_locally(request, exception) else rescue_action_in_public(exception) @@ -112,11 +110,6 @@ module ActionDispatch end end - # True if the request came from localhost, 127.0.0.1. - def local_request?(request) - LOCALHOST.any? { |local_ip| local_ip === request.remote_addr && local_ip === request.remote_ip } - end - def status_code(exception) Rack::Utils.status_code(@@rescue_responses[exception.class.name]) end -- cgit v1.2.3 From cfbfb86730719f31e42a1a177a05e1745dde934b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 13 Aug 2010 14:44:58 -0700 Subject: removing a lolinject --- actionpack/lib/action_view/helpers/form_options_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index ee34452769..3c4d0b65f4 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -300,12 +300,12 @@ module ActionView container = container.to_a if Hash === container selected, disabled = extract_selected_and_disabled(selected) - options_for_select = container.inject([]) do |options, element| + options_for_select = container.map do |element| html_attributes = option_html_attributes(element) text, value = option_text_and_value(element) selected_attribute = ' selected="selected"' if option_value_selected?(value, selected) disabled_attribute = ' disabled="disabled"' if disabled && option_value_selected?(value, disabled) - options << %() + %() end options_for_select.join("\n").html_safe -- cgit v1.2.3 From b95d6e84b00bd926b1118f6a820eca7a870b8c35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- actionpack/CHANGELOG | 4 +- actionpack/README.rdoc | 4 +- actionpack/RUNNING_UNIT_TESTS | 4 +- actionpack/lib/abstract_controller/base.rb | 2 +- .../action_controller/metal/http_authentication.rb | 4 +- actionpack/lib/action_controller/middleware.rb | 2 +- actionpack/lib/action_controller/test_case.rb | 2 +- .../vendor/html-scanner/html/document.rb | 4 +- .../vendor/html-scanner/html/node.rb | 58 +++++++------- .../vendor/html-scanner/html/sanitizer.rb | 50 ++++++------ .../vendor/html-scanner/html/selector.rb | 2 +- .../vendor/html-scanner/html/tokenizer.rb | 16 ++-- actionpack/lib/action_dispatch/http/mime_type.rb | 20 ++--- actionpack/lib/action_dispatch/middleware/stack.rb | 2 +- actionpack/lib/action_dispatch/routing.rb | 8 +- actionpack/lib/action_view/helpers/debug_helper.rb | 2 +- .../lib/action_view/helpers/form_options_helper.rb | 16 ++-- .../lib/action_view/helpers/form_tag_helper.rb | 16 ++-- .../lib/action_view/helpers/number_helper.rb | 2 +- .../lib/action_view/helpers/raw_output_helper.rb | 2 +- .../lib/action_view/helpers/sanitize_helper.rb | 4 +- actionpack/lib/action_view/helpers/text_helper.rb | 4 +- .../lib/action_view/helpers/translation_helper.rb | 18 ++--- actionpack/lib/action_view/log_subscriber.rb | 2 +- actionpack/lib/action_view/template/handler.rb | 2 +- actionpack/lib/action_view/template/handlers.rb | 2 +- actionpack/lib/action_view/test_case.rb | 2 +- actionpack/lib/action_view/testing/resolvers.rb | 2 +- actionpack/test/abstract/callbacks_test.rb | 92 +++++++++++----------- actionpack/test/abstract/helper_test.rb | 8 +- actionpack/test/abstract/translation_test.rb | 8 +- actionpack/test/abstract_unit.rb | 2 +- actionpack/test/controller/assert_select_test.rb | 2 +- actionpack/test/controller/base_test.rb | 12 +-- actionpack/test/controller/dispatcher_test.rb | 2 +- actionpack/test/controller/filters_test.rb | 2 +- actionpack/test/controller/helper_test.rb | 14 ++-- .../controller/http_basic_authentication_test.rb | 6 +- .../controller/http_token_authentication_test.rb | 6 +- actionpack/test/controller/layout_test.rb | 4 +- actionpack/test/controller/mime_responds_test.rb | 10 +-- actionpack/test/controller/new_base/etag_test.rb | 2 +- .../new_base/render_implicit_action_test.rb | 4 +- .../test/controller/new_base/render_layout_test.rb | 2 +- .../controller/new_base/render_partial_test.rb | 14 ++-- actionpack/test/controller/new_base/render_test.rb | 2 +- .../test/controller/new_base/render_text_test.rb | 24 +++--- .../test/controller/new_base/render_xml_test.rb | 2 +- actionpack/test/controller/render_test.rb | 4 +- actionpack/test/controller/rescue_test.rb | 2 +- actionpack/test/controller/selector_test.rb | 8 +- actionpack/test/controller/test_test.rb | 2 +- actionpack/test/controller/view_paths_test.rb | 4 +- actionpack/test/dispatch/callbacks_test.rb | 2 +- actionpack/test/dispatch/mount_test.rb | 2 +- actionpack/test/dispatch/request_test.rb | 2 +- .../test/dispatch/session/cookie_store_test.rb | 8 +- .../test/dispatch/session/mem_cache_store_test.rb | 2 +- actionpack/test/fixtures/companies.yml | 2 +- actionpack/test/fixtures/company.rb | 2 +- actionpack/test/fixtures/db_definitions/sqlite.sql | 20 ++--- actionpack/test/fixtures/replies.yml | 2 +- .../test/fixtures/test/hello_xml_world.builder | 2 +- actionpack/test/fixtures/topics.yml | 2 +- .../test/template/compiled_templates_test.rb | 2 +- actionpack/test/template/date_helper_i18n_test.rb | 2 +- actionpack/test/template/date_helper_test.rb | 28 +++---- actionpack/test/template/erb_util_test.rb | 2 +- .../test/template/form_options_helper_test.rb | 12 +-- .../test/template/html-scanner/document_test.rb | 2 +- actionpack/test/template/html-scanner/node_test.rb | 18 ++--- .../test/template/html-scanner/sanitizer_test.rb | 34 ++++---- .../test/template/html-scanner/tag_node_test.rb | 46 +++++------ .../test/template/html-scanner/text_node_test.rb | 10 +-- .../test/template/html-scanner/tokenizer_test.rb | 20 ++--- actionpack/test/template/number_helper_test.rb | 2 +- actionpack/test/template/tag_helper_test.rb | 6 +- actionpack/test/template/text_helper_test.rb | 12 +-- .../test/template/translation_helper_test.rb | 8 +- actionpack/test/template/url_helper_test.rb | 4 +- 80 files changed, 374 insertions(+), 374 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 81abb8b5f1..dce2e30d3f 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -26,7 +26,7 @@ resources :comments end end - + You can now use comment_path for /comments/1 instead of post_comment_path for /posts/1/comments/1. * Add support for multi-subdomain session by setting cookie host in session cookie so you can share session between www.example.com, example.com and user.example.com. #4818 [Guillermo Álvarez] @@ -110,7 +110,7 @@ * ActionDispatch::Request#content_type returns a String to be compatible with Rack::Request. Use #content_mime_type for the Mime::Type instance [YK] -* Updated Prototype to 1.6.1 and Scriptaculous to 1.8.3 [ML] +* Updated Prototype to 1.6.1 and Scriptaculous to 1.8.3 [ML] * Change the preferred way that URL helpers are included into a class[YK & CL] diff --git a/actionpack/README.rdoc b/actionpack/README.rdoc index b297ceb0e2..0ad33cfe26 100644 --- a/actionpack/README.rdoc +++ b/actionpack/README.rdoc @@ -102,10 +102,10 @@ A short rundown of some of the major features: class WeblogController < ActionController::Base # filters as methods before_filter :authenticate, :cache, :audit - + # filter as a proc after_filter { |c| c.response.body = Gzip::compress(c.response.body) } - + # class filter after_filter LocalizeFilter diff --git a/actionpack/RUNNING_UNIT_TESTS b/actionpack/RUNNING_UNIT_TESTS index 95a8bc7497..d6a1ccf871 100644 --- a/actionpack/RUNNING_UNIT_TESTS +++ b/actionpack/RUNNING_UNIT_TESTS @@ -1,7 +1,7 @@ == Running with Rake The easiest way to run the unit tests is through Rake. The default task runs -the entire test suite for all classes. For more information, checkout the +the entire test suite for all classes. For more information, checkout the full array of rake tasks with "rake -T" Rake can be found at http://rake.rubyforge.org @@ -16,7 +16,7 @@ you can do so with something like: == Dependency on ActiveRecord and database setup Test cases in the test/controller/active_record/ directory depend on having -activerecord and sqlite installed. If ActiveRecord is not in +activerecord and sqlite installed. If ActiveRecord is not in actionpack/../activerecord directory, or the sqlite rubygem is not installed, these tests are skipped. diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index db0a6736e0..79ebf29c7f 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -109,7 +109,7 @@ module AbstractController @_action_name = action_name = action.to_s unless action_name = method_for_action(action_name) - raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}" + raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}" end @_response_body = nil diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index b0eb24a4a8..acd313b039 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -392,11 +392,11 @@ module ActionController end end - # If token Authorization header is present, call the login procedure with + # If token Authorization header is present, call the login procedure with # the present token and options. # # controller - ActionController::Base instance for the current request. - # login_procedure - Proc to call if a token is present. The Proc should + # login_procedure - Proc to call if a token is present. The Proc should # take 2 arguments: # authenticate(controller) { |token, options| ... } # diff --git a/actionpack/lib/action_controller/middleware.rb b/actionpack/lib/action_controller/middleware.rb index 2115b07b3e..437fec3dc6 100644 --- a/actionpack/lib/action_controller/middleware.rb +++ b/actionpack/lib/action_controller/middleware.rb @@ -31,7 +31,7 @@ module ActionController super() @_app = app end - + def index call(env) end diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index e306697f4b..e02fe202e1 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -311,7 +311,7 @@ module ActionController def tests(controller_class) self.controller_class = controller_class end - + def controller_class=(new_class) prepare_controller_class(new_class) if new_class write_inheritable_attribute(:controller_class, new_class) diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb index b8d73c350d..7fa3aead82 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb @@ -48,7 +48,7 @@ EOF end end end - + # Search the tree for (and return) the first node that matches the given # conditions. The conditions are interpreted differently for different node # types, see HTML::Text#find and HTML::Tag#find. @@ -62,7 +62,7 @@ EOF def find_all(conditions) @root.find_all(conditions) end - + end end diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb index a874519978..d581399514 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb @@ -1,7 +1,7 @@ require 'strscan' module HTML #:nodoc: - + class Conditions < Hash #:nodoc: def initialize(hash) super() @@ -57,17 +57,17 @@ module HTML #:nodoc: class Node #:nodoc: # The array of children of this node. Not all nodes have children. attr_reader :children - + # The parent node of this node. All nodes have a parent, except for the # root node. attr_reader :parent - + # The line number of the input where this node was begun attr_reader :line - + # The byte position in the input where this node was begun attr_reader :position - + # Create a new node as a child of the given parent. def initialize(parent, line=0, pos=0) @parent = parent @@ -92,7 +92,7 @@ module HTML #:nodoc: # returns non +nil+. Returns the result of the #find call that succeeded. def find(conditions) conditions = validate_conditions(conditions) - @children.each do |child| + @children.each do |child| node = child.find(conditions) return node if node end @@ -133,7 +133,7 @@ module HTML #:nodoc: equivalent end - + class </) if strict - raise "expected > (got #{scanner.rest.inspect} for #{content}, #{attributes.inspect})" + raise "expected > (got #{scanner.rest.inspect} for #{content}, #{attributes.inspect})" else # throw away all text until we find what we're looking for scanner.skip_until(/>/) or scanner.terminate @@ -212,9 +212,9 @@ module HTML #:nodoc: # A node that represents text, rather than markup. class Text < Node #:nodoc: - + attr_reader :content - + # Creates a new text node as a child of the given parent, with the given # content. def initialize(parent, line, pos, content) @@ -240,7 +240,7 @@ module HTML #:nodoc: def find(conditions) match(conditions) && self end - + # Returns non-+nil+ if this node meets the given conditions, or +nil+ # otherwise. See the discussion of #find for the valid conditions. def match(conditions) @@ -268,7 +268,7 @@ module HTML #:nodoc: content == node.content end end - + # A CDATA node is simply a text node with a specialized way of displaying # itself. class CDATA < Text #:nodoc: @@ -281,16 +281,16 @@ module HTML #:nodoc: # closing tag, or a self-closing tag. It has a name, and may have a hash of # attributes. class Tag < Node #:nodoc: - + # Either +nil+, :close, or :self attr_reader :closing - + # Either +nil+, or a hash of attributes for this node. attr_reader :attributes # The name of this tag. attr_reader :name - + # Create a new node as a child of the given parent, using the given content # to describe the node. It will be parsed and the node name, attributes and # closing status extracted. @@ -344,7 +344,7 @@ module HTML #:nodoc: def tag? true end - + # Returns +true+ if the node meets any of the given conditions. The # +conditions+ parameter must be a hash of any of the following keys # (all are optional): @@ -404,7 +404,7 @@ module HTML #:nodoc: # node.match :descendant => { :tag => "strong" } # # # test if the node has between 2 and 4 span tags as immediate children - # node.match :children => { :count => 2..4, :only => { :tag => "span" } } + # node.match :children => { :count => 2..4, :only => { :tag => "span" } } # # # get funky: test to see if the node is a "div", has a "ul" ancestor # # and an "li" parent (with "class" = "enum"), and whether or not it has @@ -439,7 +439,7 @@ module HTML #:nodoc: # test children return false unless children.find { |child| child.match(conditions[:child]) } if conditions[:child] - + # test ancestors if conditions[:ancestor] return false unless catch :found do @@ -457,13 +457,13 @@ module HTML #:nodoc: child.match(:descendant => conditions[:descendant]) end end - + # count children if opts = conditions[:children] matches = children.select do |c| (c.kind_of?(HTML::Tag) and (c.closing == :self or ! c.childless?)) end - + matches = matches.select { |c| c.match(opts[:only]) } if opts[:only] opts.each do |key, value| next if key == :only @@ -489,24 +489,24 @@ module HTML #:nodoc: self_index = siblings.index(self) if conditions[:sibling] - return false unless siblings.detect do |s| + return false unless siblings.detect do |s| s != self && s.match(conditions[:sibling]) end end if conditions[:before] - return false unless siblings[self_index+1..-1].detect do |s| + return false unless siblings[self_index+1..-1].detect do |s| s != self && s.match(conditions[:before]) end end if conditions[:after] - return false unless siblings[0,self_index].detect do |s| + return false unless siblings[0,self_index].detect do |s| s != self && s.match(conditions[:after]) end end end - + true end @@ -515,7 +515,7 @@ module HTML #:nodoc: return false unless closing == node.closing && self.name == node.name attributes == node.attributes end - + private # Match the given value to the given condition. def match_condition(value, condition) diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb index 51e0868995..dceddb9b80 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb @@ -7,11 +7,11 @@ module HTML return text unless sanitizeable?(text) tokenize(text, options).join end - + def sanitizeable?(text) !(text.nil? || text.empty? || !text.index("<")) end - + protected def tokenize(text, options) tokenizer = HTML::Tokenizer.new(text) @@ -22,12 +22,12 @@ module HTML end result end - + def process_node(node, result, options) result << node.to_s end end - + class FullSanitizer < Sanitizer def sanitize(text, options = {}) result = super @@ -37,12 +37,12 @@ module HTML # Recurse - handle all dirty nested tags result == text ? result : sanitize(result, options) end - + def process_node(node, result, options) result << node.to_s if node.class == HTML::Text end end - + class LinkSanitizer < FullSanitizer cattr_accessor :included_tags, :instance_writer => false self.included_tags = Set.new(%w(a href)) @@ -50,13 +50,13 @@ module HTML def sanitizeable?(text) !(text.nil? || text.empty? || !((text.index(""))) end - + protected def process_node(node, result, options) - result << node.to_s unless node.is_a?(HTML::Tag) && included_tags.include?(node.name) + result << node.to_s unless node.is_a?(HTML::Tag) && included_tags.include?(node.name) end end - + class WhiteListSanitizer < Sanitizer [:protocol_separator, :uri_attributes, :allowed_attributes, :allowed_tags, :allowed_protocols, :bad_tags, :allowed_css_properties, :allowed_css_keywords, :shorthand_css_properties].each do |attr| @@ -66,35 +66,35 @@ module HTML # A regular expression of the valid characters used to separate protocols like # the ':' in 'http://foo.com' self.protocol_separator = /:|(�*58)|(p)|(%|%)3A/ - + # Specifies a Set of HTML attributes that can have URIs. self.uri_attributes = Set.new(%w(href src cite action longdesc xlink:href lowsrc)) # Specifies a Set of 'bad' tags that the #sanitize helper will remove completely, as opposed # to just escaping harmless tags like <font> self.bad_tags = Set.new(%w(script)) - + # Specifies the default Set of tags that the #sanitize helper will allow unscathed. - self.allowed_tags = Set.new(%w(strong em b i p code pre tt samp kbd var sub - sup dfn cite big small address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr + self.allowed_tags = Set.new(%w(strong em b i p code pre tt samp kbd var sub + sup dfn cite big small address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr acronym a img blockquote del ins)) - # Specifies the default Set of html attributes that the #sanitize helper will leave + # Specifies the default Set of html attributes that the #sanitize helper will leave # in the allowed tag. self.allowed_attributes = Set.new(%w(href src width height alt cite datetime title class name xml:lang abbr)) - + # Specifies the default Set of acceptable css properties that #sanitize and #sanitize_css will accept. - self.allowed_protocols = Set.new(%w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto + self.allowed_protocols = Set.new(%w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto feed svn urn aim rsync tag ssh sftp rtsp afs)) - + # Specifies the default Set of acceptable css keywords that #sanitize and #sanitize_css will accept. - self.allowed_css_properties = Set.new(%w(azimuth background-color border-bottom-color border-collapse - border-color border-left-color border-right-color border-top-color clear color cursor direction display + self.allowed_css_properties = Set.new(%w(azimuth background-color border-bottom-color border-collapse + border-color border-left-color border-right-color border-top-color clear color cursor direction display elevation float font font-family font-size font-style font-variant font-weight height letter-spacing line-height overflow pause pause-after pause-before pitch pitch-range richness speak speak-header speak-numeral speak-punctuation speech-rate stress text-align text-decoration text-indent unicode-bidi vertical-align voice-family volume white-space width)) - + # Specifies the default Set of acceptable css keywords that #sanitize and #sanitize_css will accept. self.allowed_css_keywords = Set.new(%w(auto aqua black block blue bold both bottom brown center collapse dashed dotted fuchsia gray green !important italic left lime maroon medium none navy normal @@ -118,9 +118,9 @@ module HTML style.scan(/([-\w]+)\s*:\s*([^:;]*)/) do |prop,val| if allowed_css_properties.include?(prop.downcase) clean << prop + ': ' + val + ';' - elsif shorthand_css_properties.include?(prop.split('-')[0].downcase) + elsif shorthand_css_properties.include?(prop.split('-')[0].downcase) unless val.split().any? do |keyword| - !allowed_css_keywords.include?(keyword) && + !allowed_css_keywords.include?(keyword) && keyword !~ /^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$/ end clean << prop + ': ' + val + ';' @@ -146,7 +146,7 @@ module HTML else options[:parent].unshift node.name end - + process_attributes_for node, options options[:tags].include?(node.name) ? node : nil @@ -154,7 +154,7 @@ module HTML bad_tags.include?(options[:parent].first) ? nil : node.to_s.gsub(/:not. For example: # p:not(.post) # Matches all paragraphs that do not have the class .post. - # + # # === Substitution Values # # You can use substitution with identifiers, class names and element values. diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb index 240dc1890f..c252e01cf5 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb @@ -1,7 +1,7 @@ require 'strscan' module HTML #:nodoc: - + # A simple HTML tokenizer. It simply breaks a stream of text into tokens, where each # token is a string. Each string represents either "text", or an HTML element. # @@ -14,13 +14,13 @@ module HTML #:nodoc: # p token # end class Tokenizer #:nodoc: - + # The current (byte) position in the text attr_reader :position - + # The current line number attr_reader :line - + # Create a new Tokenizer for the given text. def initialize(text) text.encode! if text.encoding_aware? @@ -42,7 +42,7 @@ module HTML #:nodoc: update_current_line(scan_text) end end - + private # Treat the text at the current position as a tag, and scan it. Supports @@ -69,13 +69,13 @@ module HTML #:nodoc: def scan_text "#{@scanner.getch}#{@scanner.scan(/[^<]*/)}" end - + # Counts the number of newlines in the text and updates the current line # accordingly. def update_current_line(text) text.scan(/\r?\n/) { @current_line += 1 } end - + # Skips over quoted strings, so that less-than and greater-than characters # within the strings are ignored. def consume_quoted_regions @@ -103,5 +103,5 @@ module HTML #:nodoc: text end end - + end diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index c6fc582851..8f1c9b6691 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -109,10 +109,10 @@ module Mime else # keep track of creation order to keep the subsequent sort stable list = [] - accept_header.split(/,/).each_with_index do |header, index| - params, q = header.split(/;\s*q=/) + accept_header.split(/,/).each_with_index do |header, index| + params, q = header.split(/;\s*q=/) if params - params.strip! + params.strip! list << AcceptItem.new(index, params, q) unless params.empty? end end @@ -161,20 +161,20 @@ module Mime end end end - + def initialize(string, symbol = nil, synonyms = []) @symbol, @synonyms = symbol, synonyms @string = string end - + def to_s @string end - + def to_str to_s end - + def to_sym @symbol || @string.to_sym end @@ -186,11 +186,11 @@ module Mime super end end - + def ==(mime_type) return false if mime_type.blank? - (@synonyms + [ self ]).any? do |synonym| - synonym.to_s == mime_type.to_s || synonym.to_sym == mime_type.to_sym + (@synonyms + [ self ]).any? do |synonym| + synonym.to_s == mime_type.to_s || synonym.to_sym == mime_type.to_sym end end diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index 41078eced7..5a029a60d1 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -69,7 +69,7 @@ module ActionDispatch end def active - ActiveSupport::Deprecation.warn "All middlewares in the chain are active since the laziness " << + ActiveSupport::Deprecation.warn "All middlewares in the chain are active since the laziness " << "was removed from the middleware stack", caller end diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 683dd72555..df1b53016d 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -15,7 +15,7 @@ module ActionDispatch # match ':controller(/:action(/:id(.:format)))' # # This route states that it expects requests to consist of a - # :controller followed optionally by an :action that in + # :controller followed optionally by an :action that in # turn is followed optionally by an :id, which in turn is followed # optionally by a :format # @@ -134,8 +134,8 @@ module ActionDispatch # == HTTP Methods # # Using the :via option when specifying a route allows you to restrict it to a specific HTTP method. - # Possible values are :post, :get, :put, :delete and :any. - # If your route needs to respond to more than one method you can use an array, e.g. [ :get, :post ]. + # Possible values are :post, :get, :put, :delete and :any. + # If your route needs to respond to more than one method you can use an array, e.g. [ :get, :post ]. # The default value is :any which means that the route will respond to any of the HTTP methods. # # Examples: @@ -144,7 +144,7 @@ module ActionDispatch # match 'post/:id' => "posts#create_comment', :via => :post # # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same - # URL will route to the show action. + # URL will route to the show action. # # === HTTP helper methods # diff --git a/actionpack/lib/action_view/helpers/debug_helper.rb b/actionpack/lib/action_view/helpers/debug_helper.rb index 1491cb073f..cd67851642 100644 --- a/actionpack/lib/action_view/helpers/debug_helper.rb +++ b/actionpack/lib/action_view/helpers/debug_helper.rb @@ -1,6 +1,6 @@ module ActionView # = Action View Debug Helper - # + # # Provides a set of methods for making it easier to debug Rails objects. module Helpers module DebugHelper diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 3c4d0b65f4..698cd3e4cd 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -53,16 +53,16 @@ module ActionView # # # - # - # Like the other form helpers, +select+ can accept an :index option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this + # + # Like the other form helpers, +select+ can accept an :index option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this # option to be in the +html_options+ parameter. - # - # Example: - # + # + # Example: + # # select("album[]", "genre", %w[rap rock country], {}, { :index => nil }) - # + # # becomes: - # + # # - # + # # <%= form_tag('/posts', :remote => true) %> # # =>
- # + # def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block) html_options = html_options_for_form(url_for_options, options, *parameters_for_url) if block_given? @@ -351,12 +351,12 @@ module ActionView # Creates a submit button with the text value as the caption. # # ==== Options - # * :confirm => 'question?' - If present the unobtrusive JavaScript - # drivers will provide a prompt with the question specified. If the user accepts, + # * :confirm => 'question?' - If present the unobtrusive JavaScript + # drivers will provide a prompt with the question specified. If the user accepts, # the form is processed normally, otherwise no action is taken. # * :disabled - If true, the user will not be able to use this input. - # * :disable_with - Value of this parameter will be used as the value for a - # disabled version of the submit button when the form is submitted. This feature is + # * :disable_with - Value of this parameter will be used as the value for a + # disabled version of the submit button when the form is submitted. This feature is # provided by the unobtrusive JavaScript driver. # * Any other key creates standard HTML options for the tag. # @@ -383,7 +383,7 @@ module ActionView # # name="commit" type="submit" value="Edit" /> # # submit_tag "Save", :confirm => "Are you sure?" - # # => # def submit_tag(value = "Save changes", options = {}) diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index f11027bc93..9dc47272b0 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -325,7 +325,7 @@ module ActionView defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {}) human = I18n.translate(:'number.human.format', :locale => options[:locale], :default => {}) defaults = defaults.merge(human) - + options = options.reverse_merge(defaults) #for backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files options[:strip_insignificant_zeros] = true if not options.key?(:strip_insignificant_zeros) diff --git a/actionpack/lib/action_view/helpers/raw_output_helper.rb b/actionpack/lib/action_view/helpers/raw_output_helper.rb index da7599fa8f..216683a2e0 100644 --- a/actionpack/lib/action_view/helpers/raw_output_helper.rb +++ b/actionpack/lib/action_view/helpers/raw_output_helper.rb @@ -2,7 +2,7 @@ module ActionView #:nodoc: # = Action View Raw Output Helper module Helpers #:nodoc: module RawOutputHelper - # This method outputs without escaping a string. Since escaping tags is + # This method outputs without escaping a string. Since escaping tags is # now default, this can be used when you don't want Rails to automatically # escape tags. This is not recommended if the data is coming from the user's # input. diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb index d82005fa24..0fee34f8a4 100644 --- a/actionpack/lib/action_view/helpers/sanitize_helper.rb +++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb @@ -9,7 +9,7 @@ module ActionView # These helper methods extend Action View making them callable within your template files. module SanitizeHelper extend ActiveSupport::Concern - # This +sanitize+ helper will html encode all tags and strip all attributes that + # This +sanitize+ helper will html encode all tags and strip all attributes that # aren't specifically allowed. # # It also strips href/src tags with invalid protocols, like javascript: especially. @@ -21,7 +21,7 @@ module ActionView # # You can add or remove tags/attributes if you want to customize it a bit. # See ActionView::Base for full docs on the available options. You can add - # tags/attributes for single uses of +sanitize+ by passing either the + # tags/attributes for single uses of +sanitize+ by passing either the # :attributes or :tags options: # # Normal Use diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index c1de5c8cb3..46af3012d9 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -462,7 +462,7 @@ module ActionView text.gsub(AUTO_LINK_RE) do scheme, href = $1, $& punctuation = [] - + if auto_linked?($`, $') # do not change string; URL is already linked href @@ -507,7 +507,7 @@ module ActionView end end end - + # Detects already linked context or position in the middle of a tag def auto_linked?(left, right) (left =~ AUTO_LINK_CRE[0] and right =~ AUTO_LINK_CRE[1]) or diff --git a/actionpack/lib/action_view/helpers/translation_helper.rb b/actionpack/lib/action_view/helpers/translation_helper.rb index dac9c28ab7..13767a09f9 100644 --- a/actionpack/lib/action_view/helpers/translation_helper.rb +++ b/actionpack/lib/action_view/helpers/translation_helper.rb @@ -5,21 +5,21 @@ module ActionView module Helpers module TranslationHelper # Delegates to I18n#translate but also performs three additional functions. - # First, it'll catch MissingTranslationData exceptions and turn them into - # inline spans that contains the missing key, such that you can see in a + # First, it'll catch MissingTranslationData exceptions and turn them into + # inline spans that contains the missing key, such that you can see in a # view what is missing where. # - # Second, it'll scope the key by the current partial if the key starts - # with a period. So if you call translate(".foo") from the - # people/index.html.erb template, you'll actually be calling + # Second, it'll scope the key by the current partial if the key starts + # with a period. So if you call translate(".foo") from the + # people/index.html.erb template, you'll actually be calling # I18n.translate("people.index.foo"). This makes it less repetitive # to translate many keys within the same partials and gives you a simple framework - # for scoping them consistently. If you don't prepend the key with a period, + # for scoping them consistently. If you don't prepend the key with a period, # nothing is converted. # - # Third, it'll mark the translation as safe HTML if the key has the suffix - # "_html" or the last element of the key is the word "html". For example, - # calling translate("footer_html") or translate("footer.html") will return + # Third, it'll mark the translation as safe HTML if the key has the suffix + # "_html" or the last element of the key is the word "html". For example, + # calling translate("footer_html") or translate("footer.html") will return # a safe HTML string that won't be escaped by other HTML helper methods. This # naming convention helps to identify translations that include HTML tags so that # you know what kind of output to expect when you call translate in a template. diff --git a/actionpack/lib/action_view/log_subscriber.rb b/actionpack/lib/action_view/log_subscriber.rb index 443a0eafd1..29ffbd6fdd 100644 --- a/actionpack/lib/action_view/log_subscriber.rb +++ b/actionpack/lib/action_view/log_subscriber.rb @@ -7,7 +7,7 @@ module ActionView message = "Rendered #{from_rails_root(event.payload[:identifier])}" message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] message << (" (%.1fms)" % event.duration) - info(message) + info(message) end alias :render_partial :render_template alias :render_collection :render_template diff --git a/actionpack/lib/action_view/template/handler.rb b/actionpack/lib/action_view/template/handler.rb index 8ecc911519..c6a1bc6235 100644 --- a/actionpack/lib/action_view/template/handler.rb +++ b/actionpack/lib/action_view/template/handler.rb @@ -35,7 +35,7 @@ module ActionView end end end - + TemplateHandlers = Template::Handlers TemplateHandler = Template::Handler end diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb index 84d6474dd1..ed397699b0 100644 --- a/actionpack/lib/action_view/template/handlers.rb +++ b/actionpack/lib/action_view/template/handlers.rb @@ -18,7 +18,7 @@ module ActionView #:nodoc: @@template_handlers = {} @@default_template_handlers = nil - + def self.extensions @@template_extensions ||= @@template_handlers.keys end diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index 137281e5e9..e9d2e0b843 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -44,7 +44,7 @@ module ActionView include ActionView::Helpers attr_accessor :controller, :output_buffer, :rendered - + module ClassMethods def tests(helper_class) self.helper_class = helper_class diff --git a/actionpack/lib/action_view/testing/resolvers.rb b/actionpack/lib/action_view/testing/resolvers.rb index 578c56c6c4..97de2471cf 100644 --- a/actionpack/lib/action_view/testing/resolvers.rb +++ b/actionpack/lib/action_view/testing/resolvers.rb @@ -38,6 +38,6 @@ module ActionView #:nodoc: [ActionView::Template.new("Template generated by Null Resolver", path, handler, :virtual_path => path, :format => format)] end end - + end diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb index 232a1679e0..b2d4d5f79a 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -2,23 +2,23 @@ require 'abstract_unit' module AbstractController module Testing - + class ControllerWithCallbacks < AbstractController::Base include AbstractController::Callbacks end - + class Callback1 < ControllerWithCallbacks set_callback :process_action, :before, :first - + def first @text = "Hello world" end - + def index self.response_body = @text end end - + class TestCallbacks1 < ActiveSupport::TestCase test "basic callbacks work" do controller = Callback1.new @@ -31,21 +31,21 @@ module AbstractController before_filter :first after_filter :second around_filter :aroundz - + def first @text = "Hello world" end - + def second @second = "Goodbye" end - + def aroundz @aroundz = "FIRST" yield @aroundz << "SECOND" end - + def index self.response_body = @text.to_s end @@ -54,7 +54,7 @@ module AbstractController class Callback2Overwrite < Callback2 before_filter :first, :except => :index end - + class TestCallbacks2 < ActiveSupport::TestCase def setup @controller = Callback2.new @@ -64,12 +64,12 @@ module AbstractController result = @controller.process(:index) assert_equal "Hello world", @controller.response_body end - + test "after_filter works" do @controller.process(:index) assert_equal "Goodbye", @controller.instance_variable_get("@second") end - + test "around_filter works" do @controller.process(:index) assert_equal "FIRSTSECOND", @controller.instance_variable_get("@aroundz") @@ -81,16 +81,16 @@ module AbstractController assert_equal "", @controller.response_body end end - + class Callback3 < ControllerWithCallbacks before_filter do |c| c.instance_variable_set("@text", "Hello world") end - + after_filter do |c| c.instance_variable_set("@second", "Goodbye") end - + def index self.response_body = @text end @@ -100,41 +100,41 @@ module AbstractController def setup @controller = Callback3.new end - + test "before_filter works with procs" do result = @controller.process(:index) assert_equal "Hello world", @controller.response_body end - + test "after_filter works with procs" do result = @controller.process(:index) assert_equal "Goodbye", @controller.instance_variable_get("@second") - end + end end - + class CallbacksWithConditions < ControllerWithCallbacks before_filter :list, :only => :index before_filter :authenticate, :except => :index - + def index self.response_body = @list.join(", ") end - + def sekrit_data self.response_body = (@list + [@authenticated]).join(", ") end - + private def list @list = ["Hello", "World"] end - + def authenticate @list = [] @authenticated = "true" end end - + class TestCallbacksWithConditions < ActiveSupport::TestCase def setup @controller = CallbacksWithConditions.new @@ -144,41 +144,41 @@ module AbstractController @controller.process(:index) assert_equal "Hello, World", @controller.response_body end - + test "when :only is specified, a before filter is not triggered on other actions" do @controller.process(:sekrit_data) assert_equal "true", @controller.response_body end - + test "when :except is specified, an after filter is not triggered on that action" do result = @controller.process(:index) assert_nil @controller.instance_variable_get("@authenticated") end end - + class CallbacksWithArrayConditions < ControllerWithCallbacks before_filter :list, :only => [:index, :listy] before_filter :authenticate, :except => [:index, :listy] - + def index self.response_body = @list.join(", ") end - + def sekrit_data self.response_body = (@list + [@authenticated]).join(", ") end - + private def list @list = ["Hello", "World"] end - + def authenticate @list = [] @authenticated = "true" - end + end end - + class TestCallbacksWithArrayConditions < ActiveSupport::TestCase def setup @controller = CallbacksWithArrayConditions.new @@ -188,54 +188,54 @@ module AbstractController result = @controller.process(:index) assert_equal "Hello, World", @controller.response_body end - + test "when :only is specified with an array, a before filter is not triggered on other actions" do result = @controller.process(:sekrit_data) assert_equal "true", @controller.response_body end - + test "when :except is specified with an array, an after filter is not triggered on that action" do result = @controller.process(:index) assert_nil @controller.instance_variable_get("@authenticated") end - end - + end + class ChangedConditions < Callback2 before_filter :first, :only => :index - + def not_index self.response_body = @text.to_s end end - + class TestCallbacksWithChangedConditions < ActiveSupport::TestCase def setup @controller = ChangedConditions.new end - + test "when a callback is modified in a child with :only, it works for the :only action" do result = @controller.process(:index) assert_equal "Hello world", @controller.response_body end - + test "when a callback is modified in a child with :only, it does not work for other actions" do result = @controller.process(:not_index) assert_equal "", @controller.response_body end end - + class SetsResponseBody < ControllerWithCallbacks before_filter :set_body - + def index self.response_body = "Fail" end - + def set_body self.response_body = "Success" end end - + class TestHalting < ActiveSupport::TestCase test "when a callback sets the response body, the action should not be invoked" do controller = SetsResponseBody.new @@ -243,6 +243,6 @@ module AbstractController assert_equal "Success", controller.response_body end end - + end end diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index 15c27501f2..73941222dc 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -4,7 +4,7 @@ ActionController::Base.helpers_path = File.expand_path('../../fixtures/helpers', module AbstractController module Testing - + class ControllerWithHelpers < AbstractController::Base include AbstractController::Rendering include Helpers @@ -13,13 +13,13 @@ module AbstractController render :inline => "Module <%= included_method %>" end end - + module HelperyTest def included_method "Included" end end - + class AbstractHelpers < ControllerWithHelpers helper(HelperyTest) do def helpery_test @@ -76,6 +76,6 @@ module AbstractController end end - + end end diff --git a/actionpack/test/abstract/translation_test.rb b/actionpack/test/abstract/translation_test.rb index 09ebfab85e..8ec50fd57a 100644 --- a/actionpack/test/abstract/translation_test.rb +++ b/actionpack/test/abstract/translation_test.rb @@ -7,19 +7,19 @@ class TranslationControllerTest < Test::Unit::TestCase def setup @controller = ActionController::Base.new end - + def test_action_controller_base_responds_to_translate assert_respond_to @controller, :translate end - + def test_action_controller_base_responds_to_t assert_respond_to @controller, :t end - + def test_action_controller_base_responds_to_localize assert_respond_to @controller, :localize end - + def test_action_controller_base_responds_to_l assert_respond_to @controller, :l end diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 5be47f7c96..fb6961d4a3 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -218,7 +218,7 @@ class ActionController::IntegrationTest < ActiveSupport::TestCase end def with_autoload_path(path) - path = File.join(File.dirname(__FILE__), "fixtures", path) + path = File.join(File.dirname(__FILE__), "fixtures", path) if ActiveSupport::Dependencies.autoload_paths.include?(path) yield else diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index 4f8ad23174..ef0df9d6a8 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -257,7 +257,7 @@ class AssertSelectTest < ActionController::TestCase end assert_raise(Assertion) {assert_select_rjs :insert, :top, "test2"} end - + def test_assert_select_rjs_for_redirect_to render_rjs do |page| page.redirect_to '/' diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index ae270b751e..032c22db3b 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -87,7 +87,7 @@ class RecordIdentifierController < ActionController::Base end class ControllerClassTests < ActiveSupport::TestCase - + def test_controller_path assert_equal 'empty', EmptyController.controller_path assert_equal EmptyController.controller_path, EmptyController.new.controller_path @@ -99,7 +99,7 @@ class ControllerClassTests < ActiveSupport::TestCase assert_equal 'empty', EmptyController.controller_name assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name end - + def test_filter_parameter_logging parameters = [] config = mock(:config => mock(:filter_parameters => parameters)) @@ -164,15 +164,15 @@ class PerformActionTest < ActionController::TestCase rescue_action_in_public! end - + def test_process_should_be_precise use_controller EmptyController exception = assert_raise AbstractController::ActionNotFound do get :non_existent end - assert_equal exception.message, "The action 'non_existent' could not be found for EmptyController" + assert_equal exception.message, "The action 'non_existent' could not be found for EmptyController" end - + def test_get_on_priv_should_show_selector use_controller MethodMissingController get :shouldnt_be_called @@ -224,7 +224,7 @@ class UrlOptionsTest < ActionController::TestCase assert_equal 'http://www.override.com/from_view?locale=en', @controller.send(:from_view_url) assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options') end - end + end def test_url_helpers_does_not_become_actions with_routing do |set| diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb index 7e19bce3b7..ebe089aaf4 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -6,7 +6,7 @@ class DeprecatedDispatcherTest < ActiveSupport::TestCase def call(env) [200, {}, 'response'] end - end + end def setup ActionDispatch::Callbacks.reset_callbacks(:prepare) diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 14f1bd797a..d0fd9e8e46 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -447,7 +447,7 @@ class FilterTest < ActionController::TestCase class ::AppSweeper < ActionController::Caching::Sweeper; end class SweeperTestController < ActionController::Base - cache_sweeper :app_sweeper + cache_sweeper :app_sweeper def show render :text => 'hello world' end diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 9b9657929f..ad66f138eb 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -50,7 +50,7 @@ class HelperTest < ActiveSupport::TestCase # Set default test helper. self.test_helper = LocalAbcHelper end - + def test_deprecated_helper assert_equal expected_helper_methods, missing_methods assert_nothing_raised { @controller_class.helper TestHelper } @@ -70,25 +70,25 @@ class HelperTest < ActiveSupport::TestCase def call_controller(klass, action) request = ActionController::TestRequest.new - klass.action(action).call(request.env) + klass.action(action).call(request.env) end def test_helper_for_nested_controller - assert_equal 'hello: Iz guuut!', + assert_equal 'hello: Iz guuut!', call_controller(Fun::GamesController, "render_hello_world").last.body # request = ActionController::TestRequest.new - # + # # resp = Fun::GamesController.action(:render_hello_world).call(request.env) # assert_equal 'hello: Iz guuut!', resp.last.body end def test_helper_for_acronym_controller assert_equal "test: baz", call_controller(Fun::PdfController, "test").last.body - # + # # request = ActionController::TestRequest.new # response = ActionController::TestResponse.new # request.action = 'test' - # + # # assert_equal 'test: baz', Fun::PdfController.process(request, response).body end @@ -192,7 +192,7 @@ class IsolatedHelpersTest < ActiveSupport::TestCase def call_controller(klass, action) request = ActionController::TestRequest.new - klass.action(action).call(request.env) + klass.action(action).call(request.env) end def setup diff --git a/actionpack/test/controller/http_basic_authentication_test.rb b/actionpack/test/controller/http_basic_authentication_test.rb index 23688ca584..01c650a494 100644 --- a/actionpack/test/controller/http_basic_authentication_test.rb +++ b/actionpack/test/controller/http_basic_authentication_test.rb @@ -13,7 +13,7 @@ class HttpBasicAuthenticationTest < ActionController::TestCase def display render :text => 'Definitely Maybe' end - + def show render :text => 'Only for loooooong credentials' end @@ -33,7 +33,7 @@ class HttpBasicAuthenticationTest < ActionController::TestCase request_http_basic_authentication("SuperSecret") end end - + def authenticate_long_credentials authenticate_or_request_with_http_basic do |username, password| username == '1234567890123456789012345678901234567890' && password == '1234567890123456789012345678901234567890' @@ -56,7 +56,7 @@ class HttpBasicAuthenticationTest < ActionController::TestCase test "successful authentication with #{header.downcase} and long credentials" do @request.env[header] = encode_credentials('1234567890123456789012345678901234567890', '1234567890123456789012345678901234567890') get :show - + assert_response :success assert_equal 'Only for loooooong credentials', @response.body, "Authentication failed for request header #{header} and long credentials" end diff --git a/actionpack/test/controller/http_token_authentication_test.rb b/actionpack/test/controller/http_token_authentication_test.rb index 3dfccae3db..3054c1684c 100644 --- a/actionpack/test/controller/http_token_authentication_test.rb +++ b/actionpack/test/controller/http_token_authentication_test.rb @@ -13,7 +13,7 @@ class HttpTokenAuthenticationTest < ActionController::TestCase def display render :text => 'Definitely Maybe' end - + def show render :text => 'Only for loooooong credentials' end @@ -33,7 +33,7 @@ class HttpTokenAuthenticationTest < ActionController::TestCase request_http_token_authentication("SuperSecret") end end - + def authenticate_long_credentials authenticate_or_request_with_http_token do |token, options| token == '1234567890123456789012345678901234567890' && options[:algorithm] == 'test' @@ -56,7 +56,7 @@ class HttpTokenAuthenticationTest < ActionController::TestCase test "successful authentication with #{header.downcase} and long credentials" do @request.env[header] = encode_credentials('1234567890123456789012345678901234567890', :algorithm => 'test') get :show - + assert_response :success assert_equal 'Only for loooooong credentials', @response.body, "Authentication failed for request header #{header} and long credentials" end diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 165c61ffad..e8751747d1 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -115,7 +115,7 @@ end class LayoutSetInResponseTest < ActionController::TestCase include ActionView::Template::Handlers - + def test_layout_set_when_using_default_layout @controller = DefaultLayoutController.new get :hello @@ -127,7 +127,7 @@ class LayoutSetInResponseTest < ActionController::TestCase get :hello assert_template :layout => "layouts/item" end - + def test_layout_only_exception_when_included @controller = OnlyLayoutController.new get :hello diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index b5ce391b61..6364b7140d 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -36,7 +36,7 @@ class RespondToController < ActionController::Base type.all { render :text => "Nothing" } end end - + def json_xml_or_html respond_to do |type| type.json { render :text => 'JSON' } @@ -44,7 +44,7 @@ class RespondToController < ActionController::Base type.html { render :text => 'HTML' } end end - + def forced_xml request.format = :xml @@ -373,17 +373,17 @@ class RespondToControllerTest < ActionController::TestCase get :handle_any_any assert_equal 'Whatever you ask for, I got it', @response.body end - + def test_browser_check_with_any_any @request.accept = "application/json, application/xml" get :json_xml_or_html assert_equal 'JSON', @response.body - + @request.accept = "application/json, application/xml, */*" get :json_xml_or_html assert_equal 'HTML', @response.body end - + def test_rjs_type_skips_layout @request.accept = "text/javascript" diff --git a/actionpack/test/controller/new_base/etag_test.rb b/actionpack/test/controller/new_base/etag_test.rb index 51bfb2278a..2bca5aec6a 100644 --- a/actionpack/test/controller/new_base/etag_test.rb +++ b/actionpack/test/controller/new_base/etag_test.rb @@ -34,7 +34,7 @@ module Etags body = "teh Hello from without_layout.html.erb tagz" assert_body body assert_header "Etag", etag_for(body) - assert_status 200 + assert_status 200 end private diff --git a/actionpack/test/controller/new_base/render_implicit_action_test.rb b/actionpack/test/controller/new_base/render_implicit_action_test.rb index 90cc7933ff..9f69d20329 100644 --- a/actionpack/test/controller/new_base/render_implicit_action_test.rb +++ b/actionpack/test/controller/new_base/render_implicit_action_test.rb @@ -6,10 +6,10 @@ module RenderImplicitAction "render_implicit_action/simple/hello_world.html.erb" => "Hello world!", "render_implicit_action/simple/hyphen-ated.html.erb" => "Hello hyphen-ated!" )] - + def hello_world() end end - + class RenderImplicitActionTest < Rack::TestCase test "render a simple action with new explicit call to render" do get "/render_implicit_action/simple/hello_world" diff --git a/actionpack/test/controller/new_base/render_layout_test.rb b/actionpack/test/controller/new_base/render_layout_test.rb index 372fb66b88..bb2a953536 100644 --- a/actionpack/test/controller/new_base/render_layout_test.rb +++ b/actionpack/test/controller/new_base/render_layout_test.rb @@ -71,7 +71,7 @@ module ControllerLayouts self.view_paths = [ActionView::FixtureResolver.new( "layouts/application.html.erb" => "<%= yield %>", "controller_layouts/mismatch_format/index.js.rjs" => "page[:test].ext", - "controller_layouts/mismatch_format/implicit.rjs" => "page[:test].ext" + "controller_layouts/mismatch_format/implicit.rjs" => "page[:test].ext" )] def explicit diff --git a/actionpack/test/controller/new_base/render_partial_test.rb b/actionpack/test/controller/new_base/render_partial_test.rb index 1a1b36a65e..5c7e66dba2 100644 --- a/actionpack/test/controller/new_base/render_partial_test.rb +++ b/actionpack/test/controller/new_base/render_partial_test.rb @@ -1,27 +1,27 @@ require 'abstract_unit' module RenderPartial - + class BasicController < ActionController::Base - + self.view_paths = [ActionView::FixtureResolver.new( "render_partial/basic/_basic.html.erb" => "BasicPartial!", "render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>" )] - + def changing @test_unchanged = 'hello' render :action => "basic" - end + end end - + class TestPartial < Rack::TestCase testing BasicController - + test "rendering a partial in ActionView doesn't pull the ivars again from the controller" do get :changing assert_response("goodbyeBasicPartial!goodbye") end end - + end diff --git a/actionpack/test/controller/new_base/render_test.rb b/actionpack/test/controller/new_base/render_test.rb index d985d9f9ad..6bd7453d1a 100644 --- a/actionpack/test/controller/new_base/render_test.rb +++ b/actionpack/test/controller/new_base/render_test.rb @@ -65,7 +65,7 @@ module Render end end end - + class TestVariousObjectsAvailableInView < Rack::TestCase test "The request object is accessible in the view" do get "/render/blank_render/access_request" diff --git a/actionpack/test/controller/new_base/render_text_test.rb b/actionpack/test/controller/new_base/render_text_test.rb index 0e6f51c998..81c2a9daf2 100644 --- a/actionpack/test/controller/new_base/render_text_test.rb +++ b/actionpack/test/controller/new_base/render_text_test.rb @@ -3,7 +3,7 @@ require 'abstract_unit' module RenderText class SimpleController < ActionController::Base self.view_paths = [ActionView::FixtureResolver.new] - + def index render :text => "hello david" end @@ -14,24 +14,24 @@ module RenderText "layouts/application.html.erb" => "<%= yield %>, I'm here!", "layouts/greetings.html.erb" => "<%= yield %>, I wish thee well.", "layouts/ivar.html.erb" => "<%= yield %>, <%= @ivar %>" - )] - + )] + def index render :text => "hello david" end - + def custom_code render :text => "hello world", :status => 404 end - + def with_custom_code_as_string render :text => "hello world", :status => "404 Not Found" end - + def with_nil render :text => nil end - + def with_nil_and_status render :text => nil, :status => 403 end @@ -39,23 +39,23 @@ module RenderText def with_false render :text => false end - + def with_layout_true render :text => "hello world", :layout => true end - + def with_layout_false render :text => "hello world", :layout => false end - + def with_layout_nil render :text => "hello world", :layout => nil end - + def with_custom_layout render :text => "hello world", :layout => "greetings" end - + def with_ivar_in_layout @ivar = "hello world" render :text => "hello world", :layout => "ivar" diff --git a/actionpack/test/controller/new_base/render_xml_test.rb b/actionpack/test/controller/new_base/render_xml_test.rb index d044738a78..b8527a943d 100644 --- a/actionpack/test/controller/new_base/render_xml_test.rb +++ b/actionpack/test/controller/new_base/render_xml_test.rb @@ -1,7 +1,7 @@ require 'abstract_unit' module RenderXml - + # This has no layout and it works class BasicController < ActionController::Base self.view_paths = [ActionView::FixtureResolver.new( diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index a57a12f271..258f511f10 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -7,7 +7,7 @@ module Fun # :ported: def hello_world end - + def nested_partial_with_form_builder render :partial => ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {}, Proc.new {}) end @@ -1234,7 +1234,7 @@ class RenderTest < ActionController::TestCase assert_match(/