Rezervacije

This commit is contained in:
2024-08-06 14:16:40 +02:00
parent 8d5a410c60
commit 6d5509856f
58 changed files with 1052 additions and 3 deletions

View File

@@ -0,0 +1,49 @@
require "application_system_test_case"
class CustomersTest < ApplicationSystemTestCase
setup do
@customer = customers(:one)
end
test "visiting the index" do
visit customers_url
assert_selector "h1", text: "Customers"
end
test "should create customer" do
visit customers_url
click_on "New customer"
fill_in "Birthyear", with: @customer.birthyear
fill_in "Email", with: @customer.email
fill_in "Name", with: @customer.name
fill_in "Notes", with: @customer.notes
fill_in "Phone", with: @customer.phone
click_on "Create Customer"
assert_text "Customer was successfully created"
click_on "Back"
end
test "should update Customer" do
visit customer_url(@customer)
click_on "Edit this customer", match: :first
fill_in "Birthyear", with: @customer.birthyear
fill_in "Email", with: @customer.email
fill_in "Name", with: @customer.name
fill_in "Notes", with: @customer.notes
fill_in "Phone", with: @customer.phone
click_on "Update Customer"
assert_text "Customer was successfully updated"
click_on "Back"
end
test "should destroy Customer" do
visit customer_url(@customer)
click_on "Destroy this customer", match: :first
assert_text "Customer was successfully destroyed"
end
end

View File

@@ -0,0 +1,43 @@
require "application_system_test_case"
class PlacesTest < ApplicationSystemTestCase
setup do
@place = places(:one)
end
test "visiting the index" do
visit places_url
assert_selector "h1", text: "Places"
end
test "should create place" do
visit places_url
click_on "New place"
fill_in "Company", with: @place.company_id
fill_in "Name", with: @place.name
click_on "Create Place"
assert_text "Place was successfully created"
click_on "Back"
end
test "should update Place" do
visit place_url(@place)
click_on "Edit this place", match: :first
fill_in "Company", with: @place.company_id
fill_in "Name", with: @place.name
click_on "Update Place"
assert_text "Place was successfully updated"
click_on "Back"
end
test "should destroy Place" do
visit place_url(@place)
click_on "Destroy this place", match: :first
assert_text "Place was successfully destroyed"
end
end

View File

@@ -0,0 +1,53 @@
require "application_system_test_case"
class ReservationsTest < ApplicationSystemTestCase
setup do
@reservation = reservations(:one)
end
test "visiting the index" do
visit reservations_url
assert_selector "h1", text: "Reservations"
end
test "should create reservation" do
visit reservations_url
click_on "New reservation"
fill_in "Company", with: @reservation.company_id
fill_in "Customer", with: @reservation.customer_id
fill_in "Description", with: @reservation.description
fill_in "End time", with: @reservation.end_time
fill_in "Place", with: @reservation.place_id
fill_in "Start time", with: @reservation.start_time
fill_in "Title", with: @reservation.title
click_on "Create Reservation"
assert_text "Reservation was successfully created"
click_on "Back"
end
test "should update Reservation" do
visit reservation_url(@reservation)
click_on "Edit this reservation", match: :first
fill_in "Company", with: @reservation.company_id
fill_in "Customer", with: @reservation.customer_id
fill_in "Description", with: @reservation.description
fill_in "End time", with: @reservation.end_time
fill_in "Place", with: @reservation.place_id
fill_in "Start time", with: @reservation.start_time
fill_in "Title", with: @reservation.title
click_on "Update Reservation"
assert_text "Reservation was successfully updated"
click_on "Back"
end
test "should destroy Reservation" do
visit reservation_url(@reservation)
click_on "Destroy this reservation", match: :first
assert_text "Reservation was successfully destroyed"
end
end