From 7e1c04d86691075d172bccb8bc1c7df2e71383c3 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sun, 13 Jan 2008 00:11:39 +0000 Subject: Allow users to declare other namespaces when using the atom feed helpers. Closes #10304 [david.calavera] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8637 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/atom_feed_helper_test.rb | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb index 9efc29fbdf..9f7e5b4c6c 100644 --- a/actionpack/test/template/atom_feed_helper_test.rb +++ b/actionpack/test/template/atom_feed_helper_test.rb @@ -55,6 +55,25 @@ class ScrollsController < ActionController::Base end end EOT + FEEDS["feed_with_atomPub_namespace"] = <<-EOT + atom_feed({'xmlns:app' => 'http://www.w3.org/2007/app', + 'xmlns:openSearch' => 'http://a9.com/-/spec/opensearch/1.1/'}) 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.tag!('app:edited', Time.now) + + entry.author do |author| + author.name("DHH") + end + end + end + end + EOT def index @scrolls = [ Scroll.new(1, "1", "Hello One", "Something COOL!", Time.utc(2007, 12, 12, 15), Time.utc(2007, 12, 12, 15)), @@ -139,6 +158,15 @@ class AtomFeedTest < Test::Unit::TestCase end end + def test_feed_should_include_atomPub_namespace + with_restful_routing(:scrolls) do + get :index, :id => "feed_with_atomPub_namespace" + assert_match %r{xml:lang="en-US"}, @response.body + assert_match %r{xmlns="http://www.w3.org/2005/Atom"}, @response.body + assert_match %r{xmlns:app="http://www.w3.org/2007/app"}, @response.body + end + end + private def with_restful_routing(resources) with_routing do |set| -- cgit v1.2.3