49 lines
1.5 KiB
Ruby
49 lines
1.5 KiB
Ruby
require "test_helper"
|
|
|
|
class CompaniesControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@company = companies(:one)
|
|
end
|
|
|
|
test "should get index" do
|
|
get companies_url
|
|
assert_response :success
|
|
end
|
|
|
|
test "should get new" do
|
|
get new_company_url
|
|
assert_response :success
|
|
end
|
|
|
|
test "should create company" do
|
|
assert_difference("Company.count") do
|
|
post companies_url, params: { company: { address_line_one: @company.address_line_one, address_line_two: @company.address_line_two, city: @company.city, country: @company.country, entity: @company.entity, id_number: @company.id_number, name: @company.name, postal_code: @company.postal_code, vat_number: @company.vat_number } }
|
|
end
|
|
|
|
assert_redirected_to company_url(Company.last)
|
|
end
|
|
|
|
test "should show company" do
|
|
get company_url(@company)
|
|
assert_response :success
|
|
end
|
|
|
|
test "should get edit" do
|
|
get edit_company_url(@company)
|
|
assert_response :success
|
|
end
|
|
|
|
test "should update company" do
|
|
patch company_url(@company), params: { company: { address_line_one: @company.address_line_one, address_line_two: @company.address_line_two, city: @company.city, country: @company.country, entity: @company.entity, id_number: @company.id_number, name: @company.name, postal_code: @company.postal_code, vat_number: @company.vat_number } }
|
|
assert_redirected_to company_url(@company)
|
|
end
|
|
|
|
test "should destroy company" do
|
|
assert_difference("Company.count", -1) do
|
|
delete company_url(@company)
|
|
end
|
|
|
|
assert_redirected_to companies_url
|
|
end
|
|
end
|