58 lines
1.7 KiB
Ruby
58 lines
1.7 KiB
Ruby
require "application_system_test_case"
|
|
|
|
class CompaniesTest < ApplicationSystemTestCase
|
|
setup do
|
|
@company = companies(:one)
|
|
end
|
|
|
|
test "visiting the index" do
|
|
visit companies_url
|
|
assert_selector "h1", text: "Companies"
|
|
end
|
|
|
|
test "should create company" do
|
|
visit companies_url
|
|
click_on "New company"
|
|
|
|
fill_in "Address line one", with: @company.address_line_one
|
|
fill_in "Address line two", with: @company.address_line_two
|
|
fill_in "City", with: @company.city
|
|
fill_in "Country", with: @company.country
|
|
fill_in "Entity", with: @company.entity
|
|
fill_in "Id number", with: @company.id_number
|
|
fill_in "Name", with: @company.name
|
|
fill_in "Postal code", with: @company.postal_code
|
|
fill_in "Vat number", with: @company.vat_number
|
|
click_on "Create Company"
|
|
|
|
assert_text "Company was successfully created"
|
|
click_on "Back"
|
|
end
|
|
|
|
test "should update Company" do
|
|
visit company_url(@company)
|
|
click_on "Edit this company", match: :first
|
|
|
|
fill_in "Address line one", with: @company.address_line_one
|
|
fill_in "Address line two", with: @company.address_line_two
|
|
fill_in "City", with: @company.city
|
|
fill_in "Country", with: @company.country
|
|
fill_in "Entity", with: @company.entity
|
|
fill_in "Id number", with: @company.id_number
|
|
fill_in "Name", with: @company.name
|
|
fill_in "Postal code", with: @company.postal_code
|
|
fill_in "Vat number", with: @company.vat_number
|
|
click_on "Update Company"
|
|
|
|
assert_text "Company was successfully updated"
|
|
click_on "Back"
|
|
end
|
|
|
|
test "should destroy Company" do
|
|
visit company_url(@company)
|
|
click_on "Destroy this company", match: :first
|
|
|
|
assert_text "Company was successfully destroyed"
|
|
end
|
|
end
|