From d8d529572b21d5bfe74938857844d409eaae8259 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Tue, 7 Jan 2014 09:42:13 +0000 Subject: [PATCH] Updated a test for no direction with empty feeds as rss, changed some private keywords around for Ruby 2.1.0 style --- app/controllers/feed_controller.rb | 8 ++++---- spec/controllers/feed_controller_spec.rb | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/feed_controller.rb b/app/controllers/feed_controller.rb index 0339706..41e357a 100644 --- a/app/controllers/feed_controller.rb +++ b/app/controllers/feed_controller.rb @@ -58,10 +58,10 @@ class FeedController < ApplicationController end - private + # private - def create_item + private def create_item item = FeedItem.new(:feed_name => params[:feed_name], :title => params[:title], :description => params[:description]) @@ -80,7 +80,7 @@ class FeedController < ApplicationController end - def update_item(item) + private def update_item(item) if item.update_attribute(:description, params[:description]) flash[:notice] = "Element #{params[:title]} updated" respond_to do |format| @@ -97,7 +97,7 @@ class FeedController < ApplicationController end - def destroy_item(item) + private def destroy_item(item) if item.destroy flash[:notice] = "Element #{params[:title]} deleted" respond_to do |format| diff --git a/spec/controllers/feed_controller_spec.rb b/spec/controllers/feed_controller_spec.rb index 8c06503..c2b71a4 100644 --- a/spec/controllers/feed_controller_spec.rb +++ b/spec/controllers/feed_controller_spec.rb @@ -28,10 +28,15 @@ describe FeedController do let!(:feed_item2) { FactoryGirl.create(:feed_item, feed_name: "test_feed", title: "item 2") } - it "redirects an emtpy feed to the index" do + it "redirects an emtpy html feed to the index" do get :show, feed_name: "empty_feed" expect(response).to redirect_to(index_path) end + + it "returns an emtpy rss document for an empty feed" do + get :show, feed_name: "empty_feed", format: "rss" + expect(response.status).to be(200) + end it "responds successfully with an HTTP 200 status code" do get :show, feed_name: "test_feed" -- 2.34.1