diff options
author | Matthew M. Boedicker <matthewm@boedicker.org> | 2008-09-09 23:37:36 -0700 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-13 18:46:32 +0200 |
commit | 42cbd710bb116998f92029adacb45698905a2e3b (patch) | |
tree | 46f14aa6311dbbdc6b9d41fb3dabefddb38f36ba /actionpack/test | |
parent | b47c76b1dfaaf1d99413b94179077cd58552ba88 (diff) | |
download | rails-42cbd710bb116998f92029adacb45698905a2e3b.tar.gz rails-42cbd710bb116998f92029adacb45698905a2e3b.tar.bz2 rails-42cbd710bb116998f92029adacb45698905a2e3b.zip |
Add support for xml processing instructions in atom_feed_helper [#926 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/atom_feed_helper_test.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb index ef31ab2c76..37632f8ed5 100644 --- a/actionpack/test/template/atom_feed_helper_test.rb +++ b/actionpack/test/template/atom_feed_helper_test.rb @@ -92,6 +92,42 @@ class ScrollsController < ActionController::Base end end EOT + FEEDS["feed_with_xml_processing_instructions"] = <<-EOT + atom_feed(:schema_date => '2008', + :instruct => {'xml-stylesheet' => { :href=> 't.css', :type => 'text/css' }}) do |feed| + feed.title("My great blog!") + feed.updated((@scrolls.first.created_at)) + + for scroll in @scrolls + feed.entry(scroll) do |entry| + entry.title(scroll.title) + entry.content(scroll.body, :type => 'html') + + entry.author do |author| + author.name("DHH") + end + end + end + end + EOT + FEEDS["feed_with_xml_processing_instructions_duplicate_targets"] = <<-EOT + atom_feed(:schema_date => '2008', + :instruct => {'target1' => [{ :a => '1', :b => '2' }, { :c => '3', :d => '4' }]}) do |feed| + feed.title("My great blog!") + feed.updated((@scrolls.first.created_at)) + + for scroll in @scrolls + feed.entry(scroll) do |entry| + entry.title(scroll.title) + entry.content(scroll.body, :type => 'html') + + entry.author do |author| + author.name("DHH") + end + end + end + end + EOT def index @scrolls = [ Scroll.new(1, "1", "Hello One", "Something <i>COOL!</i>", Time.utc(2007, 12, 12, 15), Time.utc(2007, 12, 12, 15)), @@ -194,6 +230,21 @@ class AtomFeedTest < Test::Unit::TestCase end end + def test_feed_xml_processing_instructions + with_restful_routing(:scrolls) do + get :index, :id => 'feed_with_xml_processing_instructions' + assert_match %r{<\?xml-stylesheet type="text/css" href="t.css"\?>}, @response.body + end + end + + def test_feed_xml_processing_instructions_duplicate_targets + with_restful_routing(:scrolls) do + get :index, :id => 'feed_with_xml_processing_instructions_duplicate_targets' + assert_match %r{<\?target1 (a="1" b="2"|b="2" a="1")\?>}, @response.body + assert_match %r{<\?target1 (c="3" d="4"|d="4" c="3")\?>}, @response.body + end + end + private def with_restful_routing(resources) with_routing do |set| |