From 2c8f0687e57a3ffb51b55eae525a28ff4d8767c4 Mon Sep 17 00:00:00 2001 From: Skud Date: Wed, 23 Oct 2013 12:06:04 +1100 Subject: [PATCH] Added posts and comments RSS links --- app/views/comments/index.html.haml | 5 +++++ app/views/posts/index.html.haml | 13 +++++++++++++ spec/views/comments/index.html.haml_spec.rb | 4 ++++ spec/views/posts/index.html.haml_spec.rb | 5 +++++ 4 files changed, 27 insertions(+) diff --git a/app/views/comments/index.html.haml b/app/views/comments/index.html.haml index 64915fc3c..135215419 100644 --- a/app/views/comments/index.html.haml +++ b/app/views/comments/index.html.haml @@ -13,3 +13,8 @@ %div.pagination = page_entries_info @comments, :model => "comments" = will_paginate @comments + +%p + Subscribe to the #{Growstuff::Application.config.site_name} + = succeed "." do + = link_to "comments RSS feed", comments_path(:format => 'rss') diff --git a/app/views/posts/index.html.haml b/app/views/posts/index.html.haml index e691f7b6f..80eda2767 100644 --- a/app/views/posts/index.html.haml +++ b/app/views/posts/index.html.haml @@ -25,3 +25,16 @@ %div.pagination = page_entries_info @posts, :model => "posts" = will_paginate @posts + +%p + - if @author + Subscribe to + = succeed "." do + = link_to "#{@author}'s posts RSS feed", posts_path(:format => 'rss') + + - else + Subscribe to the #{Growstuff::Application.config.site_name} + = link_to "posts RSS feed", posts_path(:format => 'rss') + or + = succeed "." do + = link_to "comments RSS feed", comments_path(:format => 'rss') diff --git a/spec/views/comments/index.html.haml_spec.rb b/spec/views/comments/index.html.haml_spec.rb index dac2dcc5b..3cf270149 100644 --- a/spec/views/comments/index.html.haml_spec.rb +++ b/spec/views/comments/index.html.haml_spec.rb @@ -21,4 +21,8 @@ describe "comments/index" do rendered.should contain 'OMG LOL' rendered.should contain 'ROFL' end + + it "contains an RSS feed link" do + assert_select "a", :href => comments_path(:format => 'rss') + end end diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb index e95b1285a..3b7b02611 100644 --- a/spec/views/posts/index.html.haml_spec.rb +++ b/spec/views/posts/index.html.haml_spec.rb @@ -27,4 +27,9 @@ describe "posts/index" do it "contains two gravatar icons" do assert_select "img", :src => /gravatar\.com\/avatar/, :count => 2 end + + it "contains RSS feed links for posts and comments" do + assert_select "a", :href => posts_path(:format => 'rss') + assert_select "a", :href => comments_path(:format => 'rss') + end end