Add extra bills tracking
This commit is contained in:
parent
a21639ff6f
commit
63487a9cba
22 changed files with 353 additions and 3 deletions
48
test/controllers/extra_bills_controller_test.rb
Normal file
48
test/controllers/extra_bills_controller_test.rb
Normal file
|
@ -0,0 +1,48 @@
|
|||
require "test_helper"
|
||||
|
||||
class ExtraBillsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@extra_bill = extra_bills(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get extra_bills_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_extra_bill_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create extra_bill" do
|
||||
assert_difference("ExtraBill.count") do
|
||||
post extra_bills_url, params: { extra_bill: { amount: @extra_bill.amount, deduct_autopaid: @extra_bill.deduct_autopaid, description: @extra_bill.description } }
|
||||
end
|
||||
|
||||
assert_redirected_to extra_bill_url(ExtraBill.last)
|
||||
end
|
||||
|
||||
test "should show extra_bill" do
|
||||
get extra_bill_url(@extra_bill)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_extra_bill_url(@extra_bill)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update extra_bill" do
|
||||
patch extra_bill_url(@extra_bill), params: { extra_bill: { amount: @extra_bill.amount, deduct_autopaid: @extra_bill.deduct_autopaid, description: @extra_bill.description } }
|
||||
assert_redirected_to extra_bill_url(@extra_bill)
|
||||
end
|
||||
|
||||
test "should destroy extra_bill" do
|
||||
assert_difference("ExtraBill.count", -1) do
|
||||
delete extra_bill_url(@extra_bill)
|
||||
end
|
||||
|
||||
assert_redirected_to extra_bills_url
|
||||
end
|
||||
end
|
11
test/fixtures/extra_bills.yml
vendored
Normal file
11
test/fixtures/extra_bills.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
description: MyString
|
||||
amount: 9.99
|
||||
deduct_autopaid: false
|
||||
|
||||
two:
|
||||
description: MyString
|
||||
amount: 9.99
|
||||
deduct_autopaid: false
|
7
test/models/extra_bill_test.rb
Normal file
7
test/models/extra_bill_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require "test_helper"
|
||||
|
||||
class ExtraBillTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
45
test/system/extra_bills_test.rb
Normal file
45
test/system/extra_bills_test.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class ExtraBillsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@extra_bill = extra_bills(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit extra_bills_url
|
||||
assert_selector "h1", text: "Extra bills"
|
||||
end
|
||||
|
||||
test "should create extra bill" do
|
||||
visit extra_bills_url
|
||||
click_on "New extra 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"
|
||||
|
||||
assert_text "Extra 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
|
||||
|
||||
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"
|
||||
|
||||
assert_text "Extra 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
|
||||
|
||||
assert_text "Extra bill was successfully destroyed"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue