Sha256: 2385362361aaeff52e6f1617a88c0ac44a469589b6825d7d3e8f8f0950580138

Contents?: true

Size: 999 Bytes

Versions: 5

Compression:

Stored size: 999 Bytes

Contents

require File.dirname(__FILE__) + '/../../test/test_helper'
require File.dirname(__FILE__) + '/../spec_helper'
require 'redirect_controller'

# Re-raise errors caught by the controller.
class RedirectController; def rescue_action(e) raise e end; end

describe RedirectController do
  before do
    request.relative_url_root = nil # avoid failures if environment.rb defines a relative URL root
  end

  # Replace this with your real tests.
  def test_redirect
    get :redirect, :from => "foo/bar"
    assert_response 301
    assert_response :redirect, "/someplace/else"
  end

  def test_url_root_redirect
    @request.relative_url_root = "/blog"
    get :redirect, :from => "foo/bar"
    assert_response 301
    assert_response :redirect, "/blog/someplace/else"

    get :redirect, :from => "bar/foo"
    assert_response 301
    assert_response :redirect, "/blog/someplace/else"
  end

  def test_no_redirect
    get :redirect, :from => "something/that/isnt/there"
    assert_response 404
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typo-5.0.3.98.1 spec/controllers/redirect_controller_spec.rb
typo-5.0.3.98 spec/controllers/redirect_controller_spec.rb
typo-5.1.2 spec/controllers/redirect_controller_spec.rb
typo-5.1.1 spec/controllers/redirect_controller_spec.rb
typo-5.1 spec/controllers/redirect_controller_spec.rb