From 38522e75e9cf77185e95e6a62b3314b08c3fcc74 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Mon, 6 Jan 2014 15:04:49 +0000 Subject: [PATCH] Controller testing done --- spec/controllers/feed_controller_spec.rb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/spec/controllers/feed_controller_spec.rb b/spec/controllers/feed_controller_spec.rb index fd47791..fd533ba 100644 --- a/spec/controllers/feed_controller_spec.rb +++ b/spec/controllers/feed_controller_spec.rb @@ -31,8 +31,10 @@ describe FeedController do end describe "GET #feed" do - let!(:feed_item1) { FactoryGirl.create(:feed_item, feed_name: "test_feed", title: "item 1") } - let!(:feed_item2) { FactoryGirl.create(:feed_item, feed_name: "test_feed", title: "item 2") } + let!(:feed_item1) { FactoryGirl.create(:feed_item, + feed_name: "test_feed", title: "item 1") } + let!(:feed_item2) { FactoryGirl.create(:feed_item, + feed_name: "test_feed", title: "item 2") } it "redirects an emtpy feed to the index" do get :show, feed_name: "empty_feed" @@ -55,6 +57,23 @@ describe FeedController do expect(assigns(:feed_items)).to match_array([feed_item1, feed_item2]) end end + + + describe "POST #feed" do + let!(:feed_item1) { FactoryGirl.create(:feed_item, + title: "item 1") } + let!(:feed_item2) { FactoryGirl.create(:feed_item, + title: "item 2") } + let!(:other_feed_item) { FactoryGirl.create(:feed_item, + feed_name: "other_test_feed", title: "item") } + + it "redirects an update the feed path" do + post :update, FactoryGirl.attributes_for(:feed_item, + title: "item 1", description: "New description") + expect(response).to redirect_to(feed_path("test_feed")) + end + + end end -- 2.34.1