Swapped content of spec/request/format_spec and spec/request/update_spec
authorNeil Smith <neil.git@njae.me.uk>
Tue, 7 Jan 2014 09:53:57 +0000 (09:53 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Tue, 7 Jan 2014 09:53:57 +0000 (09:53 +0000)
spec/requests/format_spec.rb
spec/requests/update_spec.rb

index 9481d3a2413e3ea62c7619455f961b226fb837b0..b55c6f57644ebd0a58c8f7d4d6147b4c3f653fca 100644 (file)
@@ -8,51 +8,54 @@ describe "format" do
   let!(:other_feed_item) { FactoryGirl.create(:feed_item, 
       feed_name: "other_test_feed") }
 
-  it "changes the description of an existing item" do
-    post_via_redirect '', 
-      FactoryGirl.attributes_for(:feed_item, 
-              title: "item 1", description: "New description")
-    expect(assigns(:feed_items).map{|f| f.description}).to include("New description")
-    expect(assigns(:feed_items).length).to eq(2)
-    get '/index'
-    expect(assigns(:feeds).length).to eq(2)
+  it "serves index as html by default" do
+    get_via_redirect '/index'
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves index.html as html" do
+    get_via_redirect '/index.html'
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves index.rss as rss" do
+    get_via_redirect '/index.rss'
+    expect(response.header['Content-Type']).to include('application/rss+xml')
+  end
+  
+  it "serves index as html with the accept header" do
+    get_via_redirect '/index', {}, {'Accept' => 'text/html'}
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves index as rss with the accept header" do
+    get_via_redirect '/index', {}, {'Accept' => 'application/rss+xml'}
+    expect(response.header['Content-Type']).to include('application/rss+xml')
+  end
+
+  it "serves feed as html by default" do
+    get_via_redirect '/other_test_feed'
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves feed.html as html" do
+    get_via_redirect '/other_test_feed.html'
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves feed.rss as rss" do
+    get_via_redirect '/other_test_feed.rss'
+    expect(response.header['Content-Type']).to include('application/rss+xml')
   end
   
-  it "adds the item when inserting a new title into an existing feed" do
-    post_via_redirect '', 
-      FactoryGirl.attributes_for(:feed_item, title: "item 99", 
-                                 description: "New description")
-    expect(assigns(:feed_items).map{|f| f.description}).to include("New description")
-    expect(assigns(:feed_items).length).to eq(3)
-    get '/index'
-    expect(assigns(:feeds).length).to eq(2)
-  end
-    
-  it "adds a new feed when inserting a new item into a new feed" do
-    post_via_redirect '', 
-      FactoryGirl.attributes_for(:feed_item, feed_name: "new_feed")
-    expect(assigns(:feed_items).length).to eq(1)
-    expect(assigns(:feed_items)[0].feed_name).to eq("new_feed")
-    get '/index'
-    expect(assigns(:feeds).length).to eq(3)
-  end
-    
-  it "removes the item when updated with a blank description" do
-    post_via_redirect '', 
-      FactoryGirl.attributes_for(:feed_item, title: "item 1", 
-                                 description: "")
-    expect(assigns(:feed_items).map{|f| f.title}).not_to include("item 1")
-    expect(assigns(:feed_items).length).to eq(1)
-    get '/index'
-    expect(assigns(:feeds).length).to eq(2)
-  end
-    
-  it "removes the feed when deleting the last item from a feed" do
-    post_via_redirect '', 
-      FactoryGirl.attributes_for(:feed_item, feed_name: "other_test_feed",
-                                 description: "")
-    get '/index'
-    expect(assigns(:feeds).length).to eq(1)
+  it "serves feed as html with the accept header" do
+    get_via_redirect '/other_test_feed', {}, {'Accept' => 'text/html'}
+    expect(response.header['Content-Type']).to include('text/html')
+  end
+
+  it "serves feed as rss with the accept header" do
+    get_via_redirect '/other_test_feed', {}, {'Accept' => 'application/rss+xml'}
+    expect(response.header['Content-Type']).to include('application/rss+xml')
   end
 end
 
index 8f3e8a66cadd654efd10bc1d98db557c097013b6..bfe8647c91742789c0a55fe08e761e09bcc94583 100644 (file)
@@ -8,54 +8,51 @@ describe "update" do
   let!(:other_feed_item) { FactoryGirl.create(:feed_item, 
       feed_name: "other_test_feed") }
 
-  it "serves index as html by default" do
-    get_via_redirect '/index'
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves index.html as html" do
-    get_via_redirect '/index.html'
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves index.rss as rss" do
-    get_via_redirect '/index.rss'
-    expect(response.header['Content-Type']).to include('application/rss+xml')
-  end
-  
-  it "serves index as html with the accept header" do
-    get_via_redirect '/index', {}, {'Accept' => 'text/html'}
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves index as rss with the accept header" do
-    get_via_redirect '/index', {}, {'Accept' => 'application/rss+xml'}
-    expect(response.header['Content-Type']).to include('application/rss+xml')
-  end
-
-  it "serves feed as html by default" do
-    get_via_redirect '/other_test_feed'
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves feed.html as html" do
-    get_via_redirect '/other_test_feed.html'
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves feed.rss as rss" do
-    get_via_redirect '/other_test_feed.rss'
-    expect(response.header['Content-Type']).to include('application/rss+xml')
+  it "changes the description of an existing item" do
+    post_via_redirect '', 
+      FactoryGirl.attributes_for(:feed_item, 
+              title: "item 1", description: "New description")
+    expect(assigns(:feed_items).map{|f| f.description}).to include("New description")
+    expect(assigns(:feed_items).length).to eq(2)
+    get '/index'
+    expect(assigns(:feeds).length).to eq(2)
   end
   
-  it "serves feed as html with the accept header" do
-    get_via_redirect '/other_test_feed', {}, {'Accept' => 'text/html'}
-    expect(response.header['Content-Type']).to include('text/html')
-  end
-
-  it "serves feed as rss with the accept header" do
-    get_via_redirect '/other_test_feed', {}, {'Accept' => 'application/rss+xml'}
-    expect(response.header['Content-Type']).to include('application/rss+xml')
+  it "adds the item when inserting a new title into an existing feed" do
+    post_via_redirect '', 
+      FactoryGirl.attributes_for(:feed_item, title: "item 99", 
+                                 description: "New description")
+    expect(assigns(:feed_items).map{|f| f.description}).to include("New description")
+    expect(assigns(:feed_items).length).to eq(3)
+    get '/index'
+    expect(assigns(:feeds).length).to eq(2)
+  end
+    
+  it "adds a new feed when inserting a new item into a new feed" do
+    post_via_redirect '', 
+      FactoryGirl.attributes_for(:feed_item, feed_name: "new_feed")
+    expect(assigns(:feed_items).length).to eq(1)
+    expect(assigns(:feed_items)[0].feed_name).to eq("new_feed")
+    get '/index'
+    expect(assigns(:feeds).length).to eq(3)
+  end
+    
+  it "removes the item when updated with a blank description" do
+    post_via_redirect '', 
+      FactoryGirl.attributes_for(:feed_item, title: "item 1", 
+                                 description: "")
+    expect(assigns(:feed_items).map{|f| f.title}).not_to include("item 1")
+    expect(assigns(:feed_items).length).to eq(1)
+    get '/index'
+    expect(assigns(:feeds).length).to eq(2)
+  end
+    
+  it "removes the feed when deleting the last item from a feed" do
+    post_via_redirect '', 
+      FactoryGirl.attributes_for(:feed_item, feed_name: "other_test_feed",
+                                 description: "")
+    get '/index'
+    expect(assigns(:feeds).length).to eq(1)
   end
 end