budget/test/system/incomes_test.rb
Andrew Tomaka b43629bdc9 Improve some visuals (#62)
Kind of make it look better.

Reviewed-on: #62
2025-06-10 23:41:42 -04:00

52 lines
1.3 KiB
Ruby

require "application_system_test_case"
class IncomesTest < ApplicationSystemTestCase
setup do
@income = incomes(:included_1)
login(users(:one).email)
end
test "visiting the index" do
visit incomes_url
assert_selector "h1", text: "Incomes"
end
test "should create income" do
visit incomes_url
click_on "New income"
fill_in "Amount", with: @income.amount
fill_in "Description", with: @income.description
if @income.included
find("label.toggle-label[for='income_included']").click
end
select @income.member.name, from: "Member"
click_on "Create Income"
assert_text "Income was successfully created"
click_on "Back"
end
test "should update Income" do
visit income_url(@income)
click_on "Edit Income", match: :first
fill_in "Amount", with: @income.amount
fill_in "Description", with: @income.description
if @income.included
find("label.toggle-label[for='income_included']").click
end
select @income.member.name, from: "Member"
click_on "Update Income"
assert_text "Income was successfully updated"
click_on "Back"
end
test "should destroy Income" do
visit income_url(@income)
click_on "Delete", match: :first
assert_text "Income was successfully destroyed"
end
end