require "test_helper"

class JobsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @job = jobs(:one)
  end

  test "should get index" do
    get jobs_url
    assert_response :success
  end

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

  test "should create job" do
    assert_difference("Job.count") do
      post jobs_url, params: { job: { cost_center: @job.cost_center, costum_qm_plan: @job.costum_qm_plan, customer_firstname: @job.customer_firstname, customer_id_id: @job.customer_id_id, customer_lastname: @job.customer_lastname, intern: @job.intern, number_of_plans_a0: @job.number_of_plans_a0, number_of_plans_a1: @job.number_of_plans_a1, number_of_plans_a2: @job.number_of_plans_a2, number_of_plans_a3: @job.number_of_plans_a3, operator_firstname: @job.operator_firstname, operator_id_id: @job.operator_id_id, operator_lastname: @job.operator_lastname, paid: @job.paid, printed_at: @job.printed_at } }
    end

    assert_redirected_to job_url(Job.last)
  end

  test "should show job" do
    get job_url(@job)
    assert_response :success
  end

  test "should get edit" do
    get edit_job_url(@job)
    assert_response :success
  end

  test "should update job" do
    patch job_url(@job), params: { job: { cost_center: @job.cost_center, costum_qm_plan: @job.costum_qm_plan, customer_firstname: @job.customer_firstname, customer_id_id: @job.customer_id_id, customer_lastname: @job.customer_lastname, intern: @job.intern, number_of_plans_a0: @job.number_of_plans_a0, number_of_plans_a1: @job.number_of_plans_a1, number_of_plans_a2: @job.number_of_plans_a2, number_of_plans_a3: @job.number_of_plans_a3, operator_firstname: @job.operator_firstname, operator_id_id: @job.operator_id_id, operator_lastname: @job.operator_lastname, paid: @job.paid, printed_at: @job.printed_at } }
    assert_redirected_to job_url(@job)
  end

  test "should destroy job" do
    assert_difference("Job.count", -1) do
      delete job_url(@job)
    end

    assert_redirected_to jobs_url
  end
end
