diff --git a/README.rdoc b/README.rdoc index 090a6bb68c465..2e5e72c0e4b0d 100644 --- a/README.rdoc +++ b/README.rdoc @@ -34,7 +34,7 @@ link:files/vendor/rails/actionpack/README.html. 2. At the command prompt, create a new Rails application: - rails new myapp + rails new myapp where "myapp" is the application name. @@ -48,7 +48,7 @@ link:files/vendor/rails/actionpack/README.html. "Welcome aboard: You're riding Ruby on Rails!" -5. Follow the guidelines to start developing your application. You can find +5. Follow the guidelines to start developing your application. You can find the following resources handy: * The README file created within your application. diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 76eab935e5590..d2cc70fc85055 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -181,7 +181,7 @@ * ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.] -* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] +* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.] @@ -327,7 +327,7 @@ * Added that deliver_* will now return the email that was sent -* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck] +* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck] * Fixed quoting for all address headers, not just to #955 [Jamis Buck] @@ -366,7 +366,7 @@ @body = "Nothing to see here." @charset = "iso-8859-1" end - + def unencoded_subject(recipient) @recipients = recipient @subject = "testing unencoded subject" @@ -375,7 +375,7 @@ @encode_subject = false @charset = "iso-8859-1" end - + *0.6.1* (January 18th, 2005) diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 602326eef7345..dfb696eb5500e 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -5,7 +5,7 @@ are used to consolidate code for sending out forgotten passwords, welcome wishes on signup, invoices for billing, and any other use case that requires a written notification to either a person or another system. -Action Mailer is in essence a wrapper around Action Controller and the +Action Mailer is in essence a wrapper around Action Controller and the Mail gem. It provides a way to make emails using templates in the same way that Action Controller renders views using templates. @@ -23,7 +23,7 @@ This can be as simple as: class Notifier < ActionMailer::Base delivers_from 'system@loudthinking.com' - + def welcome(recipient) @recipient = recipient mail(:to => recipient, @@ -36,13 +36,13 @@ ERb) that has the instance variables that are declared in the mailer action. So the corresponding body template for the method above could look like this: - Hello there, + Hello there, Mr. <%= @recipient %> Thank you for signing up! - -And if the recipient was given as "david@loudthinking.com", the email + +And if the recipient was given as "david@loudthinking.com", the email generated would look like this: Date: Mon, 25 Jan 2010 22:48:09 +1100 @@ -55,7 +55,7 @@ generated would look like this: charset="US-ASCII"; Content-Transfer-Encoding: 7bit - Hello there, + Hello there, Mr. david@loudthinking.com @@ -75,7 +75,7 @@ Or you can just chain the methods together like: == Receiving emails To receive emails, you need to implement a public instance method called receive that takes a -tmail object as its single parameter. The Action Mailer framework has a corresponding class method, +tmail object as its single parameter. The Action Mailer framework has a corresponding class method, which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns into the tmail object and calls the receive instance method. @@ -90,7 +90,7 @@ Example: if email.has_attachments? for attachment in email.attachments - page.attachments.create({ + page.attachments.create({ :file => attachment, :description => email.subject }) end @@ -98,13 +98,13 @@ Example: end end -This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the +This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the trivial case like this: rails runner 'Mailman.receive(STDIN.read)' -However, invoking Rails in the runner for each mail to be received is very resource intensive. A single -instance of Rails should be run within a daemon if it is going to be utilized to process more than just +However, invoking Rails in the runner for each mail to be received is very resource intensive. A single +instance of Rails should be run within a daemon if it is going to be utilized to process more than just a limited number of email. == Configuration diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index f742f982f2faa..8fe5868d529ef 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -187,31 +187,31 @@ module ActionMailer #:nodoc: # with the filename +free_book.pdf+. # # = Inline Attachments - # - # You can also specify that a file should be displayed inline with other HTML. This is useful + # + # You can also specify that a file should be displayed inline with other HTML. This is useful # if you want to display a corporate logo or a photo. - # + # # class ApplicationMailer < ActionMailer::Base # def welcome(recipient) # attachments.inline['photo.png'] = File.read('path/to/photo.png') # mail(:to => recipient, :subject => "Here is what we look like") # end # end - # + # # And then to reference the image in the view, you create a welcome.html.erb file and - # make a call to +image_tag+ passing in the attachment you want to display and then call + # make a call to +image_tag+ passing in the attachment you want to display and then call # +url+ on the attachment to get the relative content id path for the image source: - # + # #

Please Don't Cringe

- # + # # <%= image_tag attachments['photo.png'].url -%> - # + # # As we are using Action View's +image_tag+ method, you can pass in any other options you want: - # + # #

Please Don't Cringe

- # + # # <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%> - # + # # = Observing and Intercepting Mails # # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 043794bb12daf..b324ba790d367 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -46,11 +46,11 @@ module ClassMethods # as alias and the default options supplied: # # Example: - # + # # add_delivery_method :sendmail, Mail::Sendmail, # :location => '/usr/sbin/sendmail', # :arguments => '-i -t' - # + # def add_delivery_method(symbol, klass, default_options={}) class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings") send(:"#{symbol}_settings=", default_options) diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index b708881edf0c8..80ffc9b7eeab2 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -15,11 +15,11 @@ def block_format(text) :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph ).format }.join("\n") - + # Make list points stand on their own line formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" } formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" } - + formatted end diff --git a/actionmailer/lib/action_mailer/old_api.rb b/actionmailer/lib/action_mailer/old_api.rb index 79d024a3505d4..2a6289c22d898 100644 --- a/actionmailer/lib/action_mailer/old_api.rb +++ b/actionmailer/lib/action_mailer/old_api.rb @@ -116,36 +116,36 @@ def attachment(params, &block) def normalize_nonfile_hash(params) content_disposition = "attachment;" - + mime_type = params.delete(:mime_type) - + if content_type = params.delete(:content_type) content_type = "#{mime_type || content_type};" end params[:body] = params.delete(:data) if params[:data] - + { :content_type => content_type, :content_disposition => content_disposition }.merge(params) end - + def normalize_file_hash(params) filename = File.basename(params.delete(:filename)) content_disposition = "attachment; filename=\"#{File.basename(filename)}\"" - + mime_type = params.delete(:mime_type) - + if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/) content_type = "#{mime_type || content_type}; filename=\"#{filename}\"" end - + params[:body] = params.delete(:data) if params[:data] - + { :content_type => content_type, :content_disposition => content_disposition }.merge(params) end - def create_mail + def create_mail m = @_message set_fields!({:subject => subject, :to => recipients, :from => from, @@ -178,14 +178,14 @@ def create_mail wrap_delivery_behavior! m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii? - + @_message end - + # Set up the default values for the various instance variables of this # mailer. Subclasses may override this method to provide different # defaults. - def initialize_defaults(method_name) + def initialize_defaults(method_name) @charset ||= self.class.default[:charset].try(:dup) @content_type ||= self.class.default[:content_type].try(:dup) @implicit_parts_order ||= self.class.default[:parts_order].try(:dup) @@ -201,7 +201,7 @@ def initialize_defaults(method_name) @body ||= {} end - def create_parts + def create_parts if String === @body @parts.unshift create_inline_part(@body) elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ } @@ -220,7 +220,7 @@ def create_parts end end - def create_inline_part(body, mime_type=nil) + def create_inline_part(body, mime_type=nil) ct = mime_type || "text/plain" main_type, sub_type = split_content_type(ct.to_s) @@ -242,11 +242,11 @@ def set_fields!(headers, charset) #:nodoc: m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to] end - def split_content_type(ct) + def split_content_type(ct) ct.to_s.split("/") end - def parse_content_type(defaults=nil) + def parse_content_type(defaults=nil) if @content_type.blank? [ nil, {} ] else diff --git a/actionmailer/lib/action_mailer/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb index 26962f972fe49..26cc474e91aee 100644 --- a/actionmailer/lib/action_mailer/tmail_compat.rb +++ b/actionmailer/lib/action_mailer/tmail_compat.rb @@ -1,12 +1,12 @@ module Mail class Message - + def set_content_type(*args) ActiveSupport::Deprecation.warn('Message#set_content_type is deprecated, please just call ' << 'Message#content_type with the same arguments', caller[0,2]) content_type(*args) end - + alias :old_transfer_encoding :transfer_encoding def transfer_encoding(value = nil) if value @@ -29,6 +29,6 @@ def original_filename 'please call Message#filename', caller[0,2]) filename end - + end end \ No newline at end of file diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index fec0ecf4774ad..fb42ccb8aa473 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -148,7 +148,7 @@ def teardown assert_equal("application/pdf", email.parts[1].mime_type) assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded) end - + test "can embed an inline attachment" do email = BaseMailer.inline_attachment # Need to call #encoded to force the JIT sort on parts @@ -413,7 +413,7 @@ def teardown BaseMailer.welcome.deliver assert_equal(1, BaseMailer.deliveries.length) end - + test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do mail = Mail::Message.new mail.expects(:do_delivery).once @@ -447,7 +447,7 @@ def teardown mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver assert_equal("Welcome from another path", mail.body.encoded) end - + test "assets tags should use ActionMailer's asset_host settings" do ActionMailer::Base.config.asset_host = "http://global.com" ActionMailer::Base.config.assets_dir = "global/" @@ -456,7 +456,7 @@ def teardown assert_equal(%{Dummy}, mail.body.to_s.strip) end - + test "assets tags should use a Mailer's asset_host settings when available" do ActionMailer::Base.config.asset_host = "global.com" ActionMailer::Base.config.assets_dir = "global/" @@ -469,12 +469,12 @@ def teardown end # Before and After hooks - + class MyObserver def self.delivered_email(mail) end end - + test "you can register an observer to the mail object that gets informed on email delivery" do ActionMailer::Base.register_observer(MyObserver) mail = BaseMailer.welcome @@ -493,7 +493,7 @@ def self.delivering_email(mail) MyInterceptor.expects(:delivering_email).with(mail) mail.deliver end - + test "being able to put proc's into the defaults hash and they get evaluated on mail sending" do mail1 = ProcMailer.welcome yesterday = 1.day.ago @@ -501,7 +501,7 @@ def self.delivering_email(mail) mail2 = ProcMailer.welcome assert(mail1['X-Proc-Method'].to_s.to_i > mail2['X-Proc-Method'].to_s.to_i) end - + test "we can call other defined methods on the class as needed" do mail = ProcMailer.welcome assert_equal("Thanks for signing up this afternoon", mail.subject) diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 22a7d19bc25bf..08f84dbf3b40e 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -128,7 +128,7 @@ def teardown Mail::Message.any_instance.expects(:deliver!).never DeliveryMailer.welcome.deliver end - + test "does not append the deliveries collection if told not to perform the delivery" do DeliveryMailer.perform_deliveries = false DeliveryMailer.deliveries.clear @@ -160,7 +160,7 @@ def teardown DeliveryMailer.welcome.deliver end end - + test "does not increment the deliveries collection on bogus deliveries" do DeliveryMailer.delivery_method = BogusDelivery DeliveryMailer.raise_delivery_errors = false @@ -168,5 +168,5 @@ def teardown DeliveryMailer.welcome.deliver assert_equal(0, DeliveryMailer.deliveries.length) end - + end diff --git a/actionmailer/test/fixtures/raw_email10 b/actionmailer/test/fixtures/raw_email10 index b1fc2b2617032..edad5ccff1ca8 100644 --- a/actionmailer/test/fixtures/raw_email10 +++ b/actionmailer/test/fixtures/raw_email10 @@ -15,6 +15,6 @@ Content-Type: text/plain; charset=X-UNKNOWN Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email2 b/actionmailer/test/fixtures/raw_email2 index 3999fcc877be0..9f87bb2a98cf1 100644 --- a/actionmailer/test/fixtures/raw_email2 +++ b/actionmailer/test/fixtures/raw_email2 @@ -32,7 +32,7 @@ To: xxxxx xxxx Subject: Fwd: Signed email causes file attachments In-Reply-To: Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_5028_7368284.1115579351471" References: diff --git a/actionmailer/test/fixtures/raw_email3 b/actionmailer/test/fixtures/raw_email3 index 771a96350d496..3a0927490ae1f 100644 --- a/actionmailer/test/fixtures/raw_email3 +++ b/actionmailer/test/fixtures/raw_email3 @@ -31,7 +31,7 @@ Reply-To: Test Tester To: xxxx@xxxx.com, xxxx@xxxx.com Subject: Another PDF Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_2192_32400445.1115745999735" X-Virus-Scanned: amavisd-new at textdrive.com diff --git a/actionmailer/test/fixtures/raw_email5 b/actionmailer/test/fixtures/raw_email5 index 151c631471093..bbe31bcdc5ef7 100644 --- a/actionmailer/test/fixtures/raw_email5 +++ b/actionmailer/test/fixtures/raw_email5 @@ -14,6 +14,6 @@ Importance: normal Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email6 b/actionmailer/test/fixtures/raw_email6 index 93289c4f92bc3..8e37bd73921a5 100644 --- a/actionmailer/test/fixtures/raw_email6 +++ b/actionmailer/test/fixtures/raw_email6 @@ -15,6 +15,6 @@ Content-Type: text/plain; charset=us-ascii Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email8 b/actionmailer/test/fixtures/raw_email8 index 2382dfdf341b0..79996365b3d0e 100644 --- a/actionmailer/test/fixtures/raw_email8 +++ b/actionmailer/test/fixtures/raw_email8 @@ -8,7 +8,7 @@ To: xxxxx xxxx Subject: Fwd: Signed email causes file attachments In-Reply-To: Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_5028_7368284.1115579351471" References: diff --git a/actionmailer/test/fixtures/raw_email9 b/actionmailer/test/fixtures/raw_email9 index 8b9b1eaa047e2..02ea0b05c530a 100644 --- a/actionmailer/test/fixtures/raw_email9 +++ b/actionmailer/test/fixtures/raw_email9 @@ -10,19 +10,19 @@ Date: Wed, 23 Feb 2005 18:20:17 -0400 From: "xxx xxx" Message-ID: <4D6AA7EB.6490534@xxx.xxx> To: xxx@xxx.com -Subject: Stop adware/spyware once and for all. +Subject: Stop adware/spyware once and for all. X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang) -You are infected with: +You are infected with: Ad Ware and Spy Ware -Get your free scan and removal download now, -before it gets any worse. +Get your free scan and removal download now, +before it gets any worse. http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt -no more? (you will still be infected) +no more? (you will still be infected) http://xxx.xxx.info/discon/?xxx@xxx.com diff --git a/actionmailer/test/fixtures/templates/signed_up.erb b/actionmailer/test/fixtures/templates/signed_up.erb index a85d5fa4424b1..7afe1f651c63b 100644 --- a/actionmailer/test/fixtures/templates/signed_up.erb +++ b/actionmailer/test/fixtures/templates/signed_up.erb @@ -1,3 +1,3 @@ -Hello there, +Hello there, Mr. <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml index 847d065c373eb..8dcf9746ccf27 100644 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml @@ -1,6 +1,6 @@ -%p Hello there, +%p Hello there, -%p +%p Mr. = @recipient from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml index 847d065c373eb..8dcf9746ccf27 100644 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml @@ -1,6 +1,6 @@ -%p Hello there, +%p Hello there, -%p +%p Mr. = @recipient from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/signed_up.html.erb b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb index a85d5fa4424b1..7afe1f651c63b 100644 --- a/actionmailer/test/fixtures/test_mailer/signed_up.html.erb +++ b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb @@ -1,3 +1,3 @@ -Hello there, +Hello there, Mr. <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb b/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb index 4c5806d30ddee..6e7875cff5b55 100644 --- a/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +++ b/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb @@ -1,4 +1,4 @@ -Hello there, +Hello there, Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> <%= welcome_url %> diff --git a/actionmailer/test/mailers/proc_mailer.rb b/actionmailer/test/mailers/proc_mailer.rb index 6a79cd71fc3ce..43916e1421449 100644 --- a/actionmailer/test/mailers/proc_mailer.rb +++ b/actionmailer/test/mailers/proc_mailer.rb @@ -6,11 +6,11 @@ class ProcMailer < ActionMailer::Base def welcome mail end - + private - + def give_a_greeting "Thanks for signing up this afternoon" end - + end diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb index 831adf3e322df..4c93eb63e2b94 100644 --- a/actionmailer/test/old_base/mail_service_test.rb +++ b/actionmailer/test/old_base/mail_service_test.rb @@ -106,7 +106,7 @@ def utf8_body(recipient) cc "Foo áëô îü " bcc "Foo áëô îü " charset "UTF-8" - + body "åœö blah" end @@ -359,7 +359,7 @@ def test_nested_parts assert_equal "text/plain", created.parts[0].parts[0].mime_type assert_equal "text/html", created.parts[0].parts[1].mime_type assert_equal "application/octet-stream", created.parts[1].mime_type - + end def test_nested_parts_with_body @@ -399,7 +399,7 @@ def test_signed_up created = nil assert_nothing_raised { created = TestMailer.signed_up(@recipient) } assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' @@ -503,7 +503,7 @@ def test_cc_bcc delivered = ActionMailer::Base.deliveries.first expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -546,10 +546,10 @@ def test_reply_to created = TestMailer.different_reply_to @recipient end assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' - + assert_equal expected.encoded, created.encoded assert_nothing_raised do @@ -558,10 +558,10 @@ def test_reply_to delivered = ActionMailer::Base.deliveries.first assert_not_nil delivered - + expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -581,7 +581,7 @@ def test_iso_charset created = TestMailer.iso_charset @recipient end assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' @@ -596,7 +596,7 @@ def test_iso_charset expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -631,7 +631,7 @@ def test_unencoded_subject expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -761,10 +761,10 @@ def test_extended_headers delivered = ActionMailer::Base.deliveries.first assert_not_nil delivered - + expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -887,7 +887,7 @@ def test_explicitly_multipart_messages assert_equal "iso-8859-1", mail.parts[1].charset assert_equal "image/jpeg", mail.parts[2].mime_type - + assert_equal "attachment", mail.parts[2][:content_disposition].disposition_type assert_equal "foo.jpg", mail.parts[2][:content_disposition].filename assert_equal "foo.jpg", mail.parts[2][:content_type].filename @@ -1005,7 +1005,7 @@ def test_decode_encoded_attachment_filename attachment = mail.attachments.last expected = "01 Quien Te Dij\212at. Pitbull.mp3" - + if expected.respond_to?(:force_encoding) result = attachment.filename.dup expected.force_encoding(Encoding::ASCII_8BIT) diff --git a/actionmailer/test/old_base/tmail_compat_test.rb b/actionmailer/test/old_base/tmail_compat_test.rb index 255205de8464a..23706e99ff111 100644 --- a/actionmailer/test/old_base/tmail_compat_test.rb +++ b/actionmailer/test/old_base/tmail_compat_test.rb @@ -31,5 +31,5 @@ def test_transfer_encoding_setter_raises_deprecation_warning end assert_equal mail.content_transfer_encoding, "base64" end - + end diff --git a/actionmailer/test/old_base/url_test.rb b/actionmailer/test/old_base/url_test.rb index b6496bfe1b3e8..b4be7dfe32594 100644 --- a/actionmailer/test/old_base/url_test.rb +++ b/actionmailer/test/old_base/url_test.rb @@ -83,7 +83,7 @@ def test_signed_up_with_url assert_nothing_raised { UrlTestMailer.signed_up_with_url(@recipient).deliver } assert_not_nil ActionMailer::Base.deliveries.first delivered = ActionMailer::Base.deliveries.first - + delivered.message_id = '<123@456>' assert_equal expected.encoded, delivered.encoded end diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 8ff604c2c78bf..5a101e852fbdc 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -32,7 +32,7 @@ def test_determine_default_mailer_raises_correct_error self.class.determine_default_mailer("NotAMailerTest") end end - + def test_charset_is_utf_8 assert_equal "UTF-8", charset end @@ -44,14 +44,14 @@ def test_assert_emails end end end - + def test_repeated_assert_emails_calls assert_nothing_raised do assert_emails 1 do TestHelperMailer.test.deliver end end - + assert_nothing_raised do assert_emails 2 do TestHelperMailer.test.deliver @@ -59,20 +59,20 @@ def test_repeated_assert_emails_calls end end end - + def test_assert_emails_with_no_block assert_nothing_raised do TestHelperMailer.test.deliver assert_emails 1 end - + assert_nothing_raised do TestHelperMailer.test.deliver TestHelperMailer.test.deliver assert_emails 3 end end - + def test_assert_no_emails assert_nothing_raised do assert_no_emails do @@ -80,17 +80,17 @@ def test_assert_no_emails end end end - + def test_assert_emails_too_few_sent error = assert_raise ActiveSupport::TestCase::Assertion do assert_emails 2 do TestHelperMailer.test.deliver end end - + assert_match(/2 .* but 1/, error.message) end - + def test_assert_emails_too_many_sent error = assert_raise ActiveSupport::TestCase::Assertion do assert_emails 1 do @@ -98,17 +98,17 @@ def test_assert_emails_too_many_sent TestHelperMailer.test.deliver end end - + assert_match(/1 .* but 2/, error.message) end - + def test_assert_no_emails_failure error = assert_raise ActiveSupport::TestCase::Assertion do assert_no_emails do TestHelperMailer.test.deliver end end - + assert_match(/0 .* but 1/, error.message) end end diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 81abb8b5f17e2..dce2e30d3f80d 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 b297ceb0e2993..0ad33cfe26bda 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 95a8bc7497cd6..d6a1ccf871426 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 db0a6736e0c3e..79ebf29c7fe5e 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -109,7 +109,7 @@ def process(action, *args) @_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 b0eb24a4a86c7..acd313b039119 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -392,11 +392,11 @@ def request_http_token_authentication(realm = "Application") 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 2115b07b3e46d..437fec3dc6c02 100644 --- a/actionpack/lib/action_controller/middleware.rb +++ b/actionpack/lib/action_controller/middleware.rb @@ -31,7 +31,7 @@ def initialize(app) 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 e306697f4bb72..e02fe202e12db 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -311,7 +311,7 @@ module ClassMethods 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 b8d73c350d82f..7fa3aead8273c 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 @@ def initialize(text, strict=false, xml=false) 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 @@ def find(conditions) 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 a8745199786d6..d581399514d9a 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 @@ def keys_to_symbols(hash) 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 @@ def match(conditions) # 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 @@ def ==(node) 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 @@ def parse(parent, line, pos, content, strict=true) # 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 @@ def to_s 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 @@ def ==(node) 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 @@ def to_s # 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 @@ def find(conditions) 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 @@ def tag? # 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 @@ def match(conditions) # 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 @@ def match(conditions) 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 @@ def match(conditions) 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 @@ def ==(node) 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 51e086899535a..dceddb9b80eba 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 @@ def sanitize(text, options = {}) 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 @@ def tokenize(text, options) 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 @@ def sanitize(text, options = {}) # 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 @@ class LinkSanitizer < FullSanitizer 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 @@ class WhiteListSanitizer < Sanitizer # 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 @@ def sanitize_css(style) 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 @@ def process_node(node, result, options) else options[:parent].unshift node.name end - + process_attributes_for node, options options[:tags].include?(node.name) ? node : nil @@ -154,7 +154,7 @@ def process_node(node, result, options) 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 240dc1890f3a4..c252e01cf5b93 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 @@ def next 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 @@ def scan_tag 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 @@ def consume_quoted_regions 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 c6fc582851275..8f1c9b66911df 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -109,10 +109,10 @@ def parse(accept_header) 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 @@ def parse(accept_header) 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 @@ def ===(list) 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 41078eced7a13..5a029a60d1f8f 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -69,7 +69,7 @@ def use(*args, &block) 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 683dd7255588e..df1b53016d115 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 1491cb073f633..cd67851642300 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 3c4d0b65f42dd..698cd3e4cdad5 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 Helpers # # # - # - # 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 @@ def radio_button_tag(name, value, checked = false, options = {}) # 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 @@ def radio_button_tag(name, value, checked = false, options = {}) # # 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 f11027bc93a29..9dc47272b0262 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -325,7 +325,7 @@ def number_to_human_size(number, options = {}) 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 da7599fa8f413..216683a2e01a7 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 d82005fa24d62..0fee34f8a4cdf 100644 --- a/actionpack/lib/action_view/helpers/sanitize_helper.rb +++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb @@ -9,7 +9,7 @@ module Helpers #:nodoc: # 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 SanitizeHelper # # 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 c1de5c8cb3bb7..46af3012d9991 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -462,7 +462,7 @@ def auto_link_urls(text, html_options = {}, options = {}) 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 @@ def auto_link_email_addresses(text, html_options = {}, options = {}) 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 dac9c28ab7c78..13767a09f9c0f 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 443a0eafd16d6..29ffbd6fddb1b 100644 --- a/actionpack/lib/action_view/log_subscriber.rb +++ b/actionpack/lib/action_view/log_subscriber.rb @@ -7,7 +7,7 @@ def render_template(event) 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 8ecc9115194d0..c6a1bc6235189 100644 --- a/actionpack/lib/action_view/template/handler.rb +++ b/actionpack/lib/action_view/template/handler.rb @@ -35,7 +35,7 @@ def render(template, local_assigns) 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 84d6474dd18fb..ed397699b02a9 100644 --- a/actionpack/lib/action_view/template/handlers.rb +++ b/actionpack/lib/action_view/template/handlers.rb @@ -18,7 +18,7 @@ def self.extended(base) @@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 137281e5e9f38..e9d2e0b843020 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -44,7 +44,7 @@ module Behavior 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 578c56c6c48cb..97de2471cfb85 100644 --- a/actionpack/lib/action_view/testing/resolvers.rb +++ b/actionpack/lib/action_view/testing/resolvers.rb @@ -38,6 +38,6 @@ def query(path, exts, formats) [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 232a1679e06e7..b2d4d5f79af8e 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -2,23 +2,23 @@ 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 @@ class Callback2 < ControllerWithCallbacks 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 @@ def index class Callback2Overwrite < Callback2 before_filter :first, :except => :index end - + class TestCallbacks2 < ActiveSupport::TestCase def setup @controller = Callback2.new @@ -64,12 +64,12 @@ def setup 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 @@ def setup 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 @@ class TestCallbacks3 < ActiveSupport::TestCase 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 @@ def setup @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 @@ def setup 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 @@ class TestHalting < ActiveSupport::TestCase 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 15c27501f2086..73941222dcb96 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -4,7 +4,7 @@ module AbstractController module Testing - + class ControllerWithHelpers < AbstractController::Base include AbstractController::Rendering include Helpers @@ -13,13 +13,13 @@ def with_module 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 @@ def test_helpers_with_module_through_block end end - + end end diff --git a/actionpack/test/abstract/translation_test.rb b/actionpack/test/abstract/translation_test.rb index 09ebfab85e22b..8ec50fd57a2a4 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 5be47f7c965c9..fb6961d4a3b0f 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -218,7 +218,7 @@ def with_routing(&block) 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 4f8ad231741b1..ef0df9d6a8c4d 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -257,7 +257,7 @@ def test_assert_select_rjs_for_positioned_insert_should_fail_when_mixing_argumen 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 ae270b751ecc5..032c22db3b35b 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 @@ def test_controller_name 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 @@ def use_controller(controller_class) 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 @@ def test_url_options_override 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 7e19bce3b7dd7..ebe089aaf4a7b 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -6,7 +6,7 @@ class DummyApp 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 14f1bd797a357..d0fd9e8e46a16 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -447,7 +447,7 @@ def filter_three 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 9b9657929fae4..ad66f138eb256 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -50,7 +50,7 @@ def setup # 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 @@ def test_helper_attr 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 @@ def index 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 23688ca5847e8..01c650a4948f8 100644 --- a/actionpack/test/controller/http_basic_authentication_test.rb +++ b/actionpack/test/controller/http_basic_authentication_test.rb @@ -13,7 +13,7 @@ def index def display render :text => 'Definitely Maybe' end - + def show render :text => 'Only for loooooong credentials' end @@ -33,7 +33,7 @@ def authenticate_with_request 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 @@ def authenticate_long_credentials 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 3dfccae3db696..3054c1684c346 100644 --- a/actionpack/test/controller/http_token_authentication_test.rb +++ b/actionpack/test/controller/http_token_authentication_test.rb @@ -13,7 +13,7 @@ def index def display render :text => 'Definitely Maybe' end - + def show render :text => 'Only for loooooong credentials' end @@ -33,7 +33,7 @@ def authenticate_with_request 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 @@ def authenticate_long_credentials 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 165c61ffadc7d..e8751747d1f64 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -115,7 +115,7 @@ def hello 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 @@ def test_layout_set_when_set_in_controller 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 b5ce391b61ad9..6364b7140d0da 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -36,7 +36,7 @@ def html_or_xml 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 @@ def json_xml_or_html type.html { render :text => 'HTML' } end end - + def forced_xml request.format = :xml @@ -373,17 +373,17 @@ def test_handle_any_any_xml 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 51bfb2278a92a..2bca5aec6a927 100644 --- a/actionpack/test/controller/new_base/etag_test.rb +++ b/actionpack/test/controller/new_base/etag_test.rb @@ -34,7 +34,7 @@ class EtagTest < Rack::TestCase 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 90cc7933ff8d5..9f69d20329582 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 @@ class SimpleController < ::ApplicationController "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 372fb66b881cf..bb2a9535364c5 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 @@ class MismatchFormatController < ::ApplicationController 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 1a1b36a65ef88..5c7e66dba2442 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 d985d9f9ad65c..6bd7453d1a2fc 100644 --- a/actionpack/test/controller/new_base/render_test.rb +++ b/actionpack/test/controller/new_base/render_test.rb @@ -65,7 +65,7 @@ class TestOnlyRenderPublicActions < Rack::TestCase 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 0e6f51c998d56..81c2a9daf243c 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 @@ module RenderText class SimpleController < ActionController::Base self.view_paths = [ActionView::FixtureResolver.new] - + def index render :text => "hello david" end @@ -14,24 +14,24 @@ class WithLayoutController < ::ApplicationController "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 @@ def with_nil_and_status 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 d044738a78a9c..b8527a943db2c 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 a57a12f27146a..258f511f10b09 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -7,7 +7,7 @@ class GamesController < ActionController::Base # :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 @@ def test_partial_with_form_builder_subclass assert_match(/