Move extra bills to credit cards

This commit is contained in:
Andrew Tomaka 2023-03-03 18:12:59 -05:00
parent c14a408f9a
commit 0887a5f6b9
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
38 changed files with 242 additions and 251 deletions

View file

@ -14,7 +14,7 @@ class ExpensesTest < ApplicationSystemTestCase
visit expenses_url
click_on "New expense"
check "Autopaid" if @expense.autopaid
check "Credit card" if @expense.credit_card
fill_in "Description", with: @expense.description
check "Estimated" if @expense.estimated
fill_in "Payment", with: @expense.payment
@ -29,7 +29,7 @@ class ExpensesTest < ApplicationSystemTestCase
visit expense_url(@expense)
click_on "Edit this expense", match: :first
check "Autopaid" if @expense.autopaid
check "Credit card" if @expense.credit_card
fill_in "Description", with: @expense.description
check "Estimated" if @expense.estimated
fill_in "Payment", with: @expense.payment

View file

@ -1,45 +1,43 @@
require "application_system_test_case"
class ExtraBillsTest < ApplicationSystemTestCase
class CreditCardBillsTest < ApplicationSystemTestCase
setup do
@extra_bill = extra_bills(:one)
@credit_card_bill = credit_card_bills(:one)
end
test "visiting the index" do
visit extra_bills_url
assert_selector "h1", text: "Extra bills"
visit credit_card_bills_url
assert_selector "h1", text: "Credit card bills"
end
test "should create extra bill" do
visit extra_bills_url
click_on "New extra bill"
test "should create credit card bill" do
visit credit_card_bills_url
click_on "New credit card bill"
fill_in "Amount", with: @extra_bill.amount
check "Deduct autopaid" if @extra_bill.deduct_autopaid
fill_in "Description", with: @extra_bill.description
click_on "Create Extra bill"
fill_in "Amount", with: @credit_card_bill.amount
fill_in "Description", with: @credit_card_bill.description
click_on "Create Credit card bill"
assert_text "Extra bill was successfully created"
assert_text "Credit card bill was successfully created"
click_on "Back"
end
test "should update Extra bill" do
visit extra_bill_url(@extra_bill)
click_on "Edit this extra bill", match: :first
test "should update Credit card bill" do
visit credit_card_bill_url(@credit_card_bill)
click_on "Edit this credit card bill", match: :first
fill_in "Amount", with: @extra_bill.amount
check "Deduct autopaid" if @extra_bill.deduct_autopaid
fill_in "Description", with: @extra_bill.description
click_on "Update Extra bill"
fill_in "Amount", with: @credit_card_bill.amount
fill_in "Description", with: @credit_card_bill.description
click_on "Update Credit card bill"
assert_text "Extra bill was successfully updated"
assert_text "Credit card bill was successfully updated"
click_on "Back"
end
test "should destroy Extra bill" do
visit extra_bill_url(@extra_bill)
click_on "Destroy this extra bill", match: :first
test "should destroy Credit card bill" do
visit credit_card_bill_url(@credit_card_bill)
click_on "Destroy this credit card bill", match: :first
assert_text "Extra bill was successfully destroyed"
assert_text "Credit card bill was successfully destroyed"
end
end