MorningPeak/test/controllers/bills_controller_test.rb
2015-06-16 20:17:16 +02:00

50 lines
1.3 KiB
Ruby

require 'test_helper'
class BillsControllerTest < ActionController::TestCase
setup do
@bill = bills(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:bills)
end
test "should get new" do
get :new
assert_response :success
end
test "should create bill" do
assert_difference('Bill.count') do
post :create, bill: { amount: @bill.amount, client_id: @bill.client_id, description: @bill.description, due_date: @bill.due_date, emission_date: @bill.emission_date, paid: @bill.paid, title: @bill.title }
end
assert_redirected_to bill_path(assigns(:bill))
end
test "should show bill" do
get :show, id: @bill
assert_response :success
end
test "should get edit" do
get :edit, id: @bill
assert_response :success
end
test "should update bill" do
patch :update, id: @bill, bill: { amount: @bill.amount, client_id: @bill.client_id, description: @bill.description, due_date: @bill.due_date, emission_date: @bill.emission_date, paid: @bill.paid, title: @bill.title }
assert_redirected_to bill_path(assigns(:bill))
end
test "should destroy bill" do
assert_difference('Bill.count', -1) do
delete :destroy, id: @bill
end
assert_redirected_to bills_path
end
end