| | 1 | require File.dirname(__FILE__) + '/../abstract_unit' |
|---|
| | 2 | require 'action_controller/integration' |
|---|
| | 3 | |
|---|
| | 4 | module ActiveRecord |
|---|
| | 5 | class Base |
|---|
| | 6 | def self.reset_subclasses; end |
|---|
| | 7 | end |
|---|
| | 8 | end |
|---|
| | 9 | |
|---|
| | 10 | module ActionController |
|---|
| | 11 | class IntegrationTest |
|---|
| | 12 | def self.fixture_table_names; []; end |
|---|
| | 13 | end |
|---|
| | 14 | |
|---|
| | 15 | class Base |
|---|
| | 16 | def self.last_instantiation |
|---|
| | 17 | controller = Object.new |
|---|
| | 18 | class << controller |
|---|
| | 19 | def request;end |
|---|
| | 20 | def response;end |
|---|
| | 21 | end |
|---|
| | 22 | controller |
|---|
| | 23 | end |
|---|
| | 24 | end |
|---|
| | 25 | end |
|---|
| | 26 | |
|---|
| | 27 | class Dispatcher |
|---|
| | 28 | def self.dispatch(cgi, options, output) |
|---|
| | 29 | unless cgi.env_table.has_key?('HTTP_REFERER') |
|---|
| | 30 | fail('Expected HTTP_REFERER in CGI env but received: ' + cgi.env_table.keys.join(', ')) |
|---|
| | 31 | end |
|---|
| | 32 | |
|---|
| | 33 | def cgi.stdoutput |
|---|
| | 34 | out = Object.new |
|---|
| | 35 | def out.string |
|---|
| | 36 | "Status: 200\r\n\r\nBODY" |
|---|
| | 37 | end |
|---|
| | 38 | out |
|---|
| | 39 | end |
|---|
| | 40 | end |
|---|
| | 41 | end |
|---|
| | 42 | |
|---|
| | 43 | class IntegrationTestTest < ActionController::IntegrationTest |
|---|
| | 44 | def test_accept_http_referer_on_redirect_back |
|---|
| | 45 | get "/sample/example", {}, {'HTTP_REFERER' => '/sample/index'} |
|---|
| | 46 | end |
|---|
| | 47 | end |