Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 51 lines (37 sloc) 1.091 kB
deef9bb created the what plugin
dcroak authored
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
a236f07 a few updates, trying to automatically add a few more mime-types
dcroak authored
23
deef9bb created the what plugin
dcroak authored
24 def setup
25 @request = ActionController::TestRequest.new
26 @response = ActionController::TestResponse.new
27
28 @controller = WhatController.new
29 @request.host = "www.example.com"
30 end
31
32 def test_html
33 @request.env["HTTP_ACCEPT"] = 'text/html'
34 get :index
35 assert_equal 'The what#index HTML formatted view.', @response.body
36 end
37
38 def test_csv
39 @request.env["HTTP_ACCEPT"] = 'text/csv'
40 get :index
41 assert_redirected_to new_what_url
42 end
a236f07 a few updates, trying to automatically add a few more mime-types
dcroak authored
43
44 # def test_new_convenience_methods
45 # types = [:gif, :iphone, :mobile, :pdf, :png]
46 # types.each do |type|
47 # assert @controller.send("#{type}?"), "ActionController::Base does not have a #{type}? instance method"
48 # end
49 # end
deef9bb created the what plugin
dcroak authored
50 end
Something went wrong with that request. Please try again.