X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=spec%2Frequests%2Fformat_spec.rb;h=93330d6a4299000f4f8257119c7698256c0e9881;hb=HEAD;hp=b55c6f57644ebd0a58c8f7d4d6147b4c3f653fca;hpb=b30c218fb6433ad9b6ba65bcefee9c3f5b88d263;p=feedcatcher.git diff --git a/spec/requests/format_spec.rb b/spec/requests/format_spec.rb index b55c6f5..93330d6 100644 --- a/spec/requests/format_spec.rb +++ b/spec/requests/format_spec.rb @@ -1,61 +1,65 @@ require 'spec_helper' describe "format" 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") } it "serves index as html by default" do get_via_redirect '/index' expect(response.header['Content-Type']).to include('text/html') + expect(response.header['Content-Type']).not_to include('application/rss+xml') end it "serves index.html as html" do get_via_redirect '/index.html' expect(response.header['Content-Type']).to include('text/html') + expect(response.header['Content-Type']).not_to include('application/rss+xml') end it "serves index.rss as rss" do get_via_redirect '/index.rss' expect(response.header['Content-Type']).to include('application/rss+xml') + expect(response.header['Content-Type']).not_to include('text/html') 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') + expect(response.header['Content-Type']).not_to include('application/rss+xml') 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') + expect(response.header['Content-Type']).not_to include('text/html') end it "serves feed as html by default" do get_via_redirect '/other_test_feed' expect(response.header['Content-Type']).to include('text/html') + expect(response.header['Content-Type']).not_to include('application/rss+xml') end it "serves feed.html as html" do get_via_redirect '/other_test_feed.html' expect(response.header['Content-Type']).to include('text/html') + expect(response.header['Content-Type']).not_to include('application/rss+xml') 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') + expect(response.header['Content-Type']).not_to include('text/html') 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') + expect(response.header['Content-Type']).not_to include('application/rss+xml') 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') + expect(response.header['Content-Type']).not_to include('text/html') end end