require "application_system_test_case" class JobsTest < ApplicationSystemTestCase setup do @job = jobs(:one) end test "visiting the index" do visit jobs_url assert_selector "h1", text: "Jobs" end test "should create job" do visit jobs_url click_on "New job" fill_in "Cost center", with: @job.cost_center fill_in "Costum qm plan", with: @job.costum_qm_plan fill_in "Costumer firstname", with: @job.costumer_firstname fill_in "Costumer id", with: @job.costumer_id_id fill_in "Costumer lastname", with: @job.costumer_lastname check "Intern" if @job.intern fill_in "Number of plans a0", with: @job.number_of_plans_a0 fill_in "Number of plans a1", with: @job.number_of_plans_a1 fill_in "Number of plans a2", with: @job.number_of_plans_a2 fill_in "Number of plans a3", with: @job.number_of_plans_a3 fill_in "Operator firstname", with: @job.operator_firstname fill_in "Operator id", with: @job.operator_id_id fill_in "Operator lastname", with: @job.operator_lastname check "Paid" if @job.paid fill_in "Printed at", with: @job.printed_at click_on "Create Job" assert_text "Job was successfully created" click_on "Back" end test "should update Job" do visit job_url(@job) click_on "Edit this job", match: :first fill_in "Cost center", with: @job.cost_center fill_in "Costum qm plan", with: @job.costum_qm_plan fill_in "Costumer firstname", with: @job.costumer_firstname fill_in "Costumer id", with: @job.costumer_id_id fill_in "Costumer lastname", with: @job.costumer_lastname check "Intern" if @job.intern fill_in "Number of plans a0", with: @job.number_of_plans_a0 fill_in "Number of plans a1", with: @job.number_of_plans_a1 fill_in "Number of plans a2", with: @job.number_of_plans_a2 fill_in "Number of plans a3", with: @job.number_of_plans_a3 fill_in "Operator firstname", with: @job.operator_firstname fill_in "Operator id", with: @job.operator_id_id fill_in "Operator lastname", with: @job.operator_lastname check "Paid" if @job.paid fill_in "Printed at", with: @job.printed_at click_on "Update Job" assert_text "Job was successfully updated" click_on "Back" end test "should destroy Job" do visit job_url(@job) click_on "Destroy this job", match: :first assert_text "Job was successfully destroyed" end end