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