require 'test_helper'

class FavoritesControllerTest < ActionController::TestCase
  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:favorites)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create favorite" do
    assert_difference('Favorite.count') do
      post :create, :favorite => { }
    end
    
    #TODO: fixme. This line below errors when run as a unit test, saying that
    #there is a routing error.
    #assert_redirected_to favorite_path(assigns(:favorite))
  end

  test "should show favorite" do
    get :show, :id => favorites(:one).id
    assert_response :success
  end

  test "should get edit" do
    get :edit, :id => favorites(:one).id
    assert_response :success
  end

  test "should update favorite" do
    put :update, :id => favorites(:one).id, :favorite => { }
      
    #TODO: fixme. Same error as the above
    #assert_redirected_to favorite_path(assigns(:favorite))
  end

  test "should destroy favorite" do
    assert_difference('Favorite.count', -1) do
      delete :destroy, :id => favorites(:one).id
    end

    assert_redirected_to favorites_path
  end
end
