require 'test_helper'

class FilterCriteriaControllerTest < ActionController::TestCase
  setup do
    @filter_criterium = filter_criteria(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:filter_criteria)
  end

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

  test "should create filter_criterium" do
    assert_difference('FilterCriterium.count') do
      post :create, filter_criterium: { field_name: @filter_criterium.field_name, owner_id: @filter_criterium.owner_id, owner_type: @filter_criterium.owner_type, title: @filter_criterium.title, type: @filter_criterium.type }
    end

    assert_redirected_to filter_criterium_path(assigns(:filter_criterium))
  end

  test "should show filter_criterium" do
    get :show, id: @filter_criterium
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @filter_criterium
    assert_response :success
  end

  test "should update filter_criterium" do
    patch :update, id: @filter_criterium, filter_criterium: { field_name: @filter_criterium.field_name, owner_id: @filter_criterium.owner_id, owner_type: @filter_criterium.owner_type, title: @filter_criterium.title, type: @filter_criterium.type }
    assert_redirected_to filter_criterium_path(assigns(:filter_criterium))
  end

  test "should destroy filter_criterium" do
    assert_difference('FilterCriterium.count', -1) do
      delete :destroy, id: @filter_criterium
    end

    assert_redirected_to filter_criteria_path
  end
end
