require 'test_helper'

class ReportsControllerTest < ActionController::TestCase
  setup do
    @report = reports(:one)
  end

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

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

  test "should create report" do
    assert_difference('Report.count') do
      post :create, report: { code: @report.code, company_id: @report.company_id, create_date: @report.create_date, cube_id: @report.cube_id, name: @report.name, project_id: @report.project_id, remark: @report.remark, remark: @report.remark, status_id: @report.status_id, subject_area_id: @report.subject_area_id, tech_name: @report.tech_name, title: @report.title }
    end

    assert_redirected_to report_path(assigns(:report))
  end

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

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

  test "should update report" do
    patch :update, id: @report, report: { code: @report.code, company_id: @report.company_id, create_date: @report.create_date, cube_id: @report.cube_id, name: @report.name, project_id: @report.project_id, remark: @report.remark, remark: @report.remark, status_id: @report.status_id, subject_area_id: @report.subject_area_id, tech_name: @report.tech_name, title: @report.title }
    assert_redirected_to report_path(assigns(:report))
  end

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

    assert_redirected_to reports_path
  end
end
