Permalink
Browse files

clues atom feed, remove index.html

  • Loading branch information...
1 parent a04cbf4 commit 8be0a5f05c01491879b45b90a6561493c8798b3c Andrew Bruce committed Sep 4, 2010
@@ -0,0 +1,9 @@
+class CluesController < ApplicationController
+ def index
+ @tracks = Track.all :order => 'id DESC'
+
+ respond_to do |format|
+ format.atom
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module CluesHelper
+end
@@ -0,0 +1,10 @@
+atom_feed do |feed|
+ feed.title "Piratical Clues"
+ feed.updated @tracks.first.created_at
+
+ @tracks.each do |track|
+ feed.entry(track) do |entry|
+ entry.title track.clue
+ end
+ end
+end
View
@@ -1,4 +1,5 @@
ActionController::Routing::Routes.draw do |map|
- map.root :controller => :home
+ map.resources :clues, :only => :index
map.resources :tracks
+ map.root :controller => :home
end
View
@@ -0,0 +1,15 @@
+Feature: Atom feed
+ As the treasure holders
+ I want an atom feed
+ So that I can syndicate the clues to all pirates
+
+ Scenario: Atom feed
+ Given there is a track with attributes:
+ | track_name | Never Gonna Give You Up |
+ | artist_name | Rick Astley |
+ | lat | 51.535041 |
+ | lng | -0.122041 |
+ When I go to the clues atom feed
+ Then I should see the atom feed
+ And I should see "N1"
+
@@ -0,0 +1,4 @@
+Then /^I should see the atom feed$/ do
+ response.body.should include('atom')
+end
+
@@ -8,6 +8,9 @@ module NavigationHelpers
def path_to(page_name)
case page_name
+ when /the clues atom feed/
+ clues_path(:format => :atom)
+
when /the home\s?page/
'/'
View
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8" />
- <title>You must dress up</title>
- </head>
- <body>
- <h1>Piracy</h1>
- <h2>Making music piracy more like real piracy.</h2>
- <p><a href="/tracks">Tracks dropped</a></p>
- </body>
-</html>

0 comments on commit 8be0a5f

Please sign in to comment.