This repository has been archived by the owner. It is now read-only.
Permalink
Newer
Older
100644 43 lines (31 sloc) 841 Bytes
1
require File.dirname(__FILE__) + '/test_helper'
2
3
class WhatController < ActionController::Base
4
5
def index
6
redirect_to_new if csv?
7
end
8
9
def new
10
end
11
12
protected
13
14
def redirect_to_new
15
redirect_to new_what_url
16
end
17
18
end
19
20
WhatController.view_paths = [ File.dirname(__FILE__) + "/fixtures/" ]
21
22
class WhatControllerTest < Test::Unit::TestCase
23
def setup
24
@request = ActionController::TestRequest.new
25
@response = ActionController::TestResponse.new
26
27
@controller = WhatController.new
28
@request.host = "www.example.com"
29
end
30
31
def test_html
32
@request.env["HTTP_ACCEPT"] = 'text/html'
33
get :index
34
assert_equal 'The what#index HTML formatted view.', @response.body
35
end
36
37
def test_csv
38
@request.env["HTTP_ACCEPT"] = 'text/csv'
39
get :index
40
assert_redirected_to new_what_url
41
end
42
end