Permalink
Browse files

Fix tests for atom feed

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent f99e5bb commit 2ec817c003b342e857052be9919c60a78a58edc4 @dhh dhh committed Sep 21, 2007
Showing with 21 additions and 21 deletions.
  1. +21 −21 actionpack/test/template/atom_feed_helper_test.rb
@@ -1,18 +1,18 @@
require "#{File.dirname(__FILE__)}/../abstract_unit"
-Post = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at)
+Scroll = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at)
-class PostsController < ActionController::Base
+class ScrollsController < ActionController::Base
FEEDS = {}
FEEDS["defaults"] = <<-EOT
atom_feed do |feed|
feed.title("My great blog!")
- feed.updated((@posts.first.created_at))
+ feed.updated((@scrolls.first.created_at))
- for post in @posts
- feed.entry(post) do |entry|
- entry.title(post.title)
- entry.content(post.body, :type => 'html')
+ 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")
@@ -24,12 +24,12 @@ class PostsController < ActionController::Base
FEEDS["entry_options"] = <<-EOT
atom_feed do |feed|
feed.title("My great blog!")
- feed.updated((@posts.first.created_at))
+ feed.updated((@scrolls.first.created_at))
- for post in @posts
- feed.entry(post, :url => "/otherstuff/" + post.to_param, :updated => Time.utc(2007, 1, post.id)) do |entry|
- entry.title(post.title)
- entry.content(post.body, :type => 'html')
+ for scroll in @scrolls
+ feed.entry(scroll, :url => "/otherstuff/" + scroll.to_param, :updated => Time.utc(2007, 1, scroll.id)) do |entry|
+ entry.title(scroll.title)
+ entry.content(scroll.body, :type => 'html')
entry.author do |author|
author.name("DHH")
@@ -40,47 +40,47 @@ class PostsController < ActionController::Base
EOT
def index
- @posts = [
- Post.new(1, "1", "Hello One", "Something <i>COOL!</i>", Time.utc(2007, 12, 12, 15), Time.utc(2007, 12, 12, 15)),
- Post.new(2, "2", "Hello Two", "Something Boring", Time.utc(2007, 12, 12, 15)),
+ @scrolls = [
+ Scroll.new(1, "1", "Hello One", "Something <i>COOL!</i>", Time.utc(2007, 12, 12, 15), Time.utc(2007, 12, 12, 15)),
+ Scroll.new(2, "2", "Hello Two", "Something Boring", Time.utc(2007, 12, 12, 15)),
]
render :inline => FEEDS[params[:id]], :type => :builder
end
end
-class RenderTest < Test::Unit::TestCase
+class AtomFeedTest < Test::Unit::TestCase
def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
- @controller = PostsController.new
+ @controller = ScrollsController.new
@request.host = "www.nextangle.com"
end
def test_feed_should_use_default_language_if_none_is_given
- with_restful_routing(:posts) do
+ with_restful_routing(:scrolls) do
get :index, :id => "defaults"
assert_match %r{xml:lang="en-US"}, @response.body
end
end
def test_feed_should_include_two_entries
- with_restful_routing(:posts) do
+ with_restful_routing(:scrolls) do
get :index, :id => "defaults"
assert_select "entry", 2
end
end
def test_entry_should_only_use_published_if_created_at_is_present
- with_restful_routing(:posts) do
+ with_restful_routing(:scrolls) do
get :index, :id => "defaults"
assert_select "published", 1
end
end
def test_entry_with_prefilled_options_should_use_those_instead_of_querying_the_record
- with_restful_routing(:posts) do
+ with_restful_routing(:scrolls) do
get :index, :id => "entry_options"
assert_select "updated", Time.utc(2007, 1, 1).xmlschema

0 comments on commit 2ec817c

Please sign in to comment.