diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-04-25 17:07:55 +1000 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-04-25 17:07:55 +1000 |
commit | e1b255aca456a5b456111b09237805fd32d15111 (patch) | |
tree | a87c8b8989449a9dbdf1c6897901f6957ec021dc /actionpack | |
parent | 60ab54113fa833a1258d687673561b9474964149 (diff) | |
parent | a5955196f2ed8a69c49a1a8c0c617ab91cb8d716 (diff) | |
download | rails-e1b255aca456a5b456111b09237805fd32d15111.tar.gz rails-e1b255aca456a5b456111b09237805fd32d15111.tar.bz2 rails-e1b255aca456a5b456111b09237805fd32d15111.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack')
24 files changed, 89 insertions, 49 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 388169d981..064e06bf92 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *Rails 3.0.0 [beta 4/release candidate] (unreleased)* +* Add support for shorthand routes like /projects/status(.:format) #4423 [Diego Carrion] + * Changed translate helper so that it doesn’t mark every translation as safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched. [Craig Davey] diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index ed5b7e1e93..a5abe9be10 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.add_dependency('activemodel', version) s.add_dependency('rack', '~> 1.1.0') s.add_dependency('rack-test', '~> 0.5.0') - s.add_dependency('rack-mount', '~> 0.6.0') + s.add_dependency('rack-mount', '~> 0.6.3') s.add_dependency('erubis', '~> 2.6.5') end diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index b3fa129929..0da0ca1893 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -63,8 +63,9 @@ module ActionController #:nodoc: included do extend ConfigMethods - @@perform_caching = true - cattr_accessor :perform_caching + delegate :perform_caching, :perform_caching=, :to => :config + singleton_class.delegate :perform_caching, :perform_caching=, :to => :config + self.perform_caching = true end diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb index 21a424e6f0..20df3a1a69 100644 --- a/actionpack/lib/action_controller/caching/pages.rb +++ b/actionpack/lib/action_controller/caching/pages.rb @@ -44,8 +44,8 @@ module ActionController #:nodoc: # For Rails, this directory has already been set to Rails.public_path (which is usually set to <tt>Rails.root + "/public"</tt>). Changing # this setting can be useful to avoid naming conflicts with files in <tt>public/</tt>, but doing so will likely require configuring your # web server to look in the new location for cached files. - @@page_cache_directory = '' - cattr_accessor :page_cache_directory + singleton_class.delegate :page_cache_directory, :page_cache_directory=, :to => :config + self.page_cache_directory = '' ## # :singleton-method: @@ -53,8 +53,8 @@ module ActionController #:nodoc: # order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is <tt>.html</tt>. # If you want something else, like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension. In cases where a request already has an # extension, such as <tt>.xml</tt> or <tt>.rss</tt>, page caching will not add an extension. This allows it to work well with RESTful apps. - @@page_cache_extension = '.html' - cattr_accessor :page_cache_extension + singleton_class.delegate :page_cache_extension, :page_cache_extension=, :to => :config + self.page_cache_extension = '.html' end module ClassMethods @@ -116,7 +116,7 @@ module ActionController #:nodoc: # Expires the page that was cached with the +options+ as a key. Example: # expire_page :controller => "lists", :action => "show" def expire_page(options = {}) - return unless perform_caching + return unless self.class.perform_caching if options.is_a?(Hash) if options[:action].is_a?(Array) @@ -135,7 +135,7 @@ module ActionController #:nodoc: # If no options are provided, the requested url is used. Example: # cache_page "I'm the cached content", :controller => "lists", :action => "show" def cache_page(content = nil, options = nil) - return unless perform_caching && caching_allowed + return unless self.class.perform_caching && caching_allowed path = case options when Hash diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb index b817bf42bc..57203ce95f 100644 --- a/actionpack/lib/action_controller/deprecated/base.rb +++ b/actionpack/lib/action_controller/deprecated/base.rb @@ -146,12 +146,15 @@ module ActionController extend DeprecatedBehavior - deprecated_config_writer :session_store deprecated_config_writer :session_options - deprecated_config_accessor :perform_caching - deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it" + deprecated_config_writer :session_store + deprecated_config_accessor :assets_dir + deprecated_config_accessor :asset_path + deprecated_config_accessor :helpers_path deprecated_config_accessor :javascripts_dir + deprecated_config_accessor :page_cache_directory + deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it" deprecated_config_accessor :stylesheets_dir delegate :consider_all_requests_local, :consider_all_requests_local=, diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index dfd8e75bcc..b3758218a2 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -1,5 +1,6 @@ require 'rack/session/abstract/id' require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/object/to_query' module ActionController module TemplateAssertions diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 362e5ec970..8b730a97ee 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -1,6 +1,7 @@ require 'digest/md5' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/class/attribute_accessors' module ActionDispatch # :nodoc: # Represents an HTTP response generated by a controller action. One can use diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 1524b00d5b..09fb1f998a 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/hash/conversions.rb' require 'action_dispatch/http/request' module ActionDispatch diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb index e8c2e74314..1b676669e2 100644 --- a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb +++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/object/with_options' module ActionDispatch module Routing diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 53585740ce..ef2826a4e8 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -66,8 +66,8 @@ module ActionDispatch path = normalize_path(path) if using_match_shorthand?(path, options) - options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1') - options[:as] ||= path[1..-1].gsub("/", "_") + options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1').sub(%r{\(.*\)}, '') + options[:as] ||= path[1..-1].gsub("/", "_").sub(%r{\(.*\)}, '') end [ path, options ] @@ -80,7 +80,7 @@ module ActionDispatch # match "account/overview" def using_match_shorthand?(path, options) - path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w\/]+$} + path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w+/?]+(\(.*\))*$} end def normalize_path(path) diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index f1965f38b9..fdbff74071 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -1,5 +1,6 @@ require 'rack/mount' require 'forwardable' +require 'active_support/core_ext/object/to_query' require 'action_dispatch/routing/deprecated_mapper' module ActionDispatch diff --git a/actionpack/lib/action_dispatch/testing/test_process.rb b/actionpack/lib/action_dispatch/testing/test_process.rb index d4eecac2de..79f309cae7 100644 --- a/actionpack/lib/action_dispatch/testing/test_process.rb +++ b/actionpack/lib/action_dispatch/testing/test_process.rb @@ -3,13 +3,13 @@ require 'action_dispatch/middleware/flash' module ActionDispatch module TestProcess def assigns(key = nil) - assigns = {} + assigns = {}.with_indifferent_access @controller.instance_variable_names.each do |ivar| next if ActionController::Base.protected_instance_variables.include?(ivar) assigns[ivar[1..-1]] = @controller.instance_variable_get(ivar) end - key.nil? ? assigns : assigns[key.to_s] + key.nil? ? assigns : assigns[key] end def session diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 105f4565e6..8f8db548c3 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -444,7 +444,7 @@ module ActionView body << content_tag(:optgroup, options_for_select(group[1], selected_key), :label => group[0]) end - body + body.html_safe end # Returns a string of option tags for pretty much any time zone in the diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 0b748d700b..4ffc5ea127 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -504,7 +504,7 @@ module ActionView "document.write('#{content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');".each_byte do |c| string << sprintf("%%%x", c) end - "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>" + "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>".html_safe elsif encode == "hex" email_address_encoded = '' email_address_obfuscated.each_byte do |c| diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index ddea9cfd92..beda7743bf 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/blank' +require 'action_controller' require 'action_controller/test_case' require 'action_view' diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 217260fdcd..115cc91467 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -53,16 +53,16 @@ class PageCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true - @request = ActionController::TestRequest.new @request.host = 'hostname.com' @request.env.delete('PATH_INFO') - @response = ActionController::TestResponse.new @controller = PageCachingTestController.new + @controller.perform_caching = true @controller.cache_store = :file_store, FILE_STORE_PATH + @response = ActionController::TestResponse.new + @params = {:controller => 'posts', :action => 'index', :only_path => true} FileUtils.rm_rf(File.dirname(FILE_STORE_PATH)) @@ -71,7 +71,7 @@ class PageCachingTest < ActionController::TestCase def teardown FileUtils.rm_rf(File.dirname(FILE_STORE_PATH)) - ActionController::Base.perform_caching = false + @controller.perform_caching = false end def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route @@ -538,9 +538,9 @@ end class FragmentCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true @store = ActiveSupport::Cache::MemoryStore.new @controller = FragmentCachingTestController.new + @controller.perform_caching = true @controller.cache_store = @store @params = {:controller => 'posts', :action => 'index'} @request = ActionController::TestRequest.new @@ -564,7 +564,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_read_fragment_with_caching_disabled - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/name', 'value') assert_nil @controller.read_fragment('name') end @@ -576,7 +576,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_fragment_exist_with_caching_disabled - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/name', 'value') assert !@controller.fragment_exist?('name') assert !@controller.fragment_exist?('other_name') @@ -590,7 +590,7 @@ class FragmentCachingTest < ActionController::TestCase def test_write_fragment_with_caching_disabled assert_nil @store.read('views/name') - ActionController::Base.perform_caching = false + @controller.perform_caching = false assert_equal 'value', @controller.write_fragment('name', 'value') assert_nil @store.read('views/name') end @@ -614,7 +614,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_fragment_for_with_disabled_caching - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/expensive', 'fragment content') fragment_computed = false @@ -688,9 +688,9 @@ end class FunctionalFragmentCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true @store = ActiveSupport::Cache::MemoryStore.new @controller = FunctionalCachingController.new + @controller.perform_caching = true @controller.cache_store = @store @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb index 20d3e77b6e..b11eba2f89 100644 --- a/actionpack/test/controller/log_subscriber_test.rb +++ b/actionpack/test/controller/log_subscriber_test.rb @@ -143,7 +143,7 @@ class ACLogSubscriberTest < ActionController::TestCase end def test_with_fragment_cache - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true get :with_fragment_cache wait @@ -151,11 +151,11 @@ class ACLogSubscriberTest < ActionController::TestCase assert_match /Exist fragment\? views\/foo/, logs[1] assert_match /Write fragment views\/foo/, logs[2] ensure - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true end def test_with_page_cache - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true get :with_page_cache wait @@ -163,7 +163,7 @@ class ACLogSubscriberTest < ActionController::TestCase assert_match /Write page/, logs[1] assert_match /\/index\.html/, logs[1] ensure - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true end def logs diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 53cd3f0801..c8ba8bcaf3 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' require 'controller/fake_models' +require 'active_support/core_ext/hash/conversions' class RespondToController < ActionController::Base layout :set_layout diff --git a/actionpack/test/controller/new_base/content_type_test.rb b/actionpack/test/controller/new_base/content_type_test.rb index 700b71a7f3..33c2e442f0 100644 --- a/actionpack/test/controller/new_base/content_type_test.rb +++ b/actionpack/test/controller/new_base/content_type_test.rb @@ -21,17 +21,11 @@ module ContentType self.view_paths = [ActionView::FixtureResolver.new( "content_type/implied/i_am_html_erb.html.erb" => "Hello world!", - "content_type/implied/i_am_xml_erb.xml.erb" => "<xml>Hello world!</xml>", + "content_type/implied/i_am_xml_erb.xml.erb" => "<xml>Hello world!</xml>", "content_type/implied/i_am_html_builder.html.builder" => "xml.p 'Hello'", - "content_type/implied/i_am_xml_builder.xml.builder" => "xml.awesome 'Hello'", - "content_type/implied/i_am_rjs_in_html.html.erb" => "<%= render 'i_am_rjs_partial' %>", - "content_type/implied/_i_am_rjs_partial.js.rjs" => "" + "content_type/implied/i_am_xml_builder.xml.builder" => "xml.awesome 'Hello'", + "content_type/implied/i_am_js_rjs.js.rjs" => "page.alert 'hello'" )] - - def i_am_html_erb() end - def i_am_xml_erb() end - def i_am_html_builder() end - def i_am_xml_builder() end end class CharsetController < ActionController::Base @@ -94,10 +88,10 @@ module ContentType assert_header "Content-Type", "application/xml; charset=utf-8" end - test "sets Content-Type as text/html when rendering *.html.erb with a RJS partial" do - get "/content_type/implied/i_am_rjs_in_html" + test "sets Content-Type as text/javascript when rendering *.js" do + get "/content_type/implied/i_am_js_rjs", "format" => "js" - assert_header "Content-Type", "text/html; charset=utf-8" + assert_header "Content-Type", "text/javascript; charset=utf-8" end end diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 6f1ce2fef7..f9fc7a0976 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -113,6 +113,11 @@ XML render :nothing => true end + def test_assigns + @foo = "foo" + render :nothing => true + end + private def rescue_action(e) raise e @@ -230,6 +235,17 @@ XML assert_equal "OK", @response.body end + def test_assigns + process :test_assigns + # assigns can be accessed using assigns(key) + # or assigns[key], where key is a string or + # a symbol + assert_equal "foo", assigns(:foo) + assert_equal "foo", assigns("foo") + assert_equal "foo", assigns[:foo] + assert_equal "foo", assigns["foo"] + end + def test_assert_tag_tag process :test_html_output diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 8940990712..5bca476b27 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -54,6 +54,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest match "/local/:action", :controller => "local" + match "/projects/status(.:format)" + constraints(:ip => /192\.168\.1\.\d\d\d/) do get 'admin' => "queenbee#index" end @@ -426,6 +428,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_projects_status + with_test_routes do + assert_equal '/projects/status', url_for(:controller => 'projects', :action => 'status', :only_path => true) + assert_equal '/projects/status.json', url_for(:controller => 'projects', :action => 'status', :format => 'json', :only_path => true) + end + end + def test_projects with_test_routes do get '/projects' diff --git a/actionpack/test/template/erb_util_test.rb b/actionpack/test/template/erb_util_test.rb index 06155b1f30..d3129d0e1a 100644 --- a/actionpack/test/template/erb_util_test.rb +++ b/actionpack/test/template/erb_util_test.rb @@ -4,12 +4,12 @@ class ErbUtilTest < Test::Unit::TestCase include ERB::Util ERB::Util::HTML_ESCAPE.each do |given, expected| - define_method "test_html_escape_#{expected.gsub /\W/, ''}" do + define_method "test_html_escape_#{expected.gsub(/\W/, '')}" do assert_equal expected, html_escape(given) end unless given == '"' - define_method "test_json_escape_#{expected.gsub /\W/, ''}" do + define_method "test_json_escape_#{expected.gsub(/\W/, '')}" do assert_equal ERB::Util::JSON_ESCAPE[given], json_escape(given) end end diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 5799e3db53..98503c32fd 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -207,6 +207,10 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_grouped_options_for_select_returns_html_safe_string + assert grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]]).html_safe? + end + def test_optgroups_with_with_options_with_hash assert_dom_equal( "<optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>\n<option value=\"Germany\">Germany</option></optgroup><optgroup label=\"North America\"><option value=\"United States\">United States</option>\n<option value=\"Canada\">Canada</option></optgroup>", diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index de63030714..4474949749 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -356,11 +356,15 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_mail_to_with_javascript - assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript") + snippet = mail_to("me@domain.com", "My email", :encode => "javascript") + assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", snippet + assert snippet.html_safe? end def test_mail_to_with_javascript_unicode - assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%75%6e%69%63%6f%64%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%3e%c3%ba%6e%69%63%6f%64%65%3c%2f%61%3e%27%29%3b'))</script>", mail_to("unicode@example.com", "únicode", :encode => "javascript") + snippet = mail_to("unicode@example.com", "únicode", :encode => "javascript") + assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%75%6e%69%63%6f%64%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%3e%c3%ba%6e%69%63%6f%64%65%3c%2f%61%3e%27%29%3b'))</script>", snippet + assert snippet.html_safe end def test_mail_with_options |