require File.dirname(__FILE__) + '/../test_helper'
require 'blog_controller'

class BlogController; def rescue_action(e) raise e end; end

class BlogControllerTest < Test::Unit::TestCase
  def setup
    @controller = BlogController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  def test_url_generation
    options = {:controller => "blog", :action => "view", :id => "1"}
    assert_generates "view/blog/1", options 
  end

  def test_url_recognition
    options = {:controller => "blog", :action => "view", :id => "2"} 
    assert_recognizes options, "view/blog/2" 
  end

  def test_url_routing
    options = {:controller => "blog", :action => "view", :id => "4"} 
    assert_routing "view/blog/4", options 
  end

  def test_named_routes
    get :view
    assert_redirected_to home_url
    assert_redirected_to :controller => 'blog'
  end
end