Controller testing done
authorNeil Smith <neil.git@njae.me.uk>
Mon, 6 Jan 2014 15:04:49 +0000 (15:04 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 6 Jan 2014 15:04:49 +0000 (15:04 +0000)
spec/controllers/feed_controller_spec.rb

index fd477916a9dfd299536f8518d6758afbcaf76c5a..fd533ba2ebca8c60efd997fafabc4840597efce9 100644 (file)
@@ -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