8f3e8a66cadd654efd10bc1d98db557c097013b6
[feedcatcher.git] / spec / requests / update_spec.rb
1 require 'spec_helper'
2
3 describe "update" do
4 let!(:feed_item1) { FactoryGirl.create(:feed_item,
5 title: "item 1") }
6 let!(:feed_item2) { FactoryGirl.create(:feed_item,
7 title: "item 2") }
8 let!(:other_feed_item) { FactoryGirl.create(:feed_item,
9 feed_name: "other_test_feed") }
10
11 it "serves index as html by default" do
12 get_via_redirect '/index'
13 expect(response.header['Content-Type']).to include('text/html')
14 end
15
16 it "serves index.html as html" do
17 get_via_redirect '/index.html'
18 expect(response.header['Content-Type']).to include('text/html')
19 end
20
21 it "serves index.rss as rss" do
22 get_via_redirect '/index.rss'
23 expect(response.header['Content-Type']).to include('application/rss+xml')
24 end
25
26 it "serves index as html with the accept header" do
27 get_via_redirect '/index', {}, {'Accept' => 'text/html'}
28 expect(response.header['Content-Type']).to include('text/html')
29 end
30
31 it "serves index as rss with the accept header" do
32 get_via_redirect '/index', {}, {'Accept' => 'application/rss+xml'}
33 expect(response.header['Content-Type']).to include('application/rss+xml')
34 end
35
36 it "serves feed as html by default" do
37 get_via_redirect '/other_test_feed'
38 expect(response.header['Content-Type']).to include('text/html')
39 end
40
41 it "serves feed.html as html" do
42 get_via_redirect '/other_test_feed.html'
43 expect(response.header['Content-Type']).to include('text/html')
44 end
45
46 it "serves feed.rss as rss" do
47 get_via_redirect '/other_test_feed.rss'
48 expect(response.header['Content-Type']).to include('application/rss+xml')
49 end
50
51 it "serves feed as html with the accept header" do
52 get_via_redirect '/other_test_feed', {}, {'Accept' => 'text/html'}
53 expect(response.header['Content-Type']).to include('text/html')
54 end
55
56 it "serves feed as rss with the accept header" do
57 get_via_redirect '/other_test_feed', {}, {'Accept' => 'application/rss+xml'}
58 expect(response.header['Content-Type']).to include('application/rss+xml')
59 end
60 end
61