Made format_spec more exacting
[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 expect(response.header['Content-Type']).not_to include('application/rss+xml')
9 end
10
11 it "serves index.html as html" do
12 get_via_redirect '/index.html'
13 expect(response.header['Content-Type']).to include('text/html')
14 expect(response.header['Content-Type']).not_to include('application/rss+xml')
15 end
16
17 it "serves index.rss as rss" do
18 get_via_redirect '/index.rss'
19 expect(response.header['Content-Type']).to include('application/rss+xml')
20 expect(response.header['Content-Type']).not_to include('text/html')
21 end
22
23 it "serves index as html with the accept header" do
24 get_via_redirect '/index', {}, {'Accept' => 'text/html'}
25 expect(response.header['Content-Type']).to include('text/html')
26 expect(response.header['Content-Type']).not_to include('application/rss+xml')
27 end
28
29 it "serves index as rss with the accept header" do
30 get_via_redirect '/index', {}, {'Accept' => 'application/rss+xml'}
31 expect(response.header['Content-Type']).to include('application/rss+xml')
32 expect(response.header['Content-Type']).not_to include('text/html')
33 end
34
35 it "serves feed as html by default" do
36 get_via_redirect '/other_test_feed'
37 expect(response.header['Content-Type']).to include('text/html')
38 expect(response.header['Content-Type']).not_to include('application/rss+xml')
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 expect(response.header['Content-Type']).not_to include('application/rss+xml')
45 end
46
47 it "serves feed.rss as rss" do
48 get_via_redirect '/other_test_feed.rss'
49 expect(response.header['Content-Type']).to include('application/rss+xml')
50 expect(response.header['Content-Type']).not_to include('text/html')
51 end
52
53 it "serves feed as html with the accept header" do
54 get_via_redirect '/other_test_feed', {}, {'Accept' => 'text/html'}
55 expect(response.header['Content-Type']).to include('text/html')
56 expect(response.header['Content-Type']).not_to include('application/rss+xml')
57 end
58
59 it "serves feed as rss with the accept header" do
60 get_via_redirect '/other_test_feed', {}, {'Accept' => 'application/rss+xml'}
61 expect(response.header['Content-Type']).to include('application/rss+xml')
62 expect(response.header['Content-Type']).not_to include('text/html')
63 end
64 end
65