Commit 3edad7bf authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

adapt tests to one click create and remove obsolete views

parent 1229484f
......@@ -9,7 +9,7 @@ class BillingExpense < ApplicationRecord
default_scope { order(created_at: :desc) }
AMOUNT = [0, 50, 100, 150].freeze
AMOUNT = [50, 100, 150].freeze
validates :amount, inclusion: { in: AMOUNT }
......
= simple_form_for [@volunteer, @billing_expense] do |f|
= simple_error_notice f
= f.hidden_field :volunteer_id, value: params[:volunteer_id]
.row
.col-xs-12
= f.button :submit
......@@ -32,7 +32,7 @@ h1= t_title(:index, BillingExpense)
.col-xs-12
= simple_form_for [@volunteer, BillingExpense.new] do |f|
= f.hidden_field :volunteer_id, value: @volunteer.id
= f.button :submits
= f.button :submit
.row
.col-xs-12
= button_link t('back'), @volunteer
.row
.col-xs-12
h1= t_title(:new)
= render 'form'
.row
.col-xs-12
= button_link t('back'), @volunteer
......@@ -13,7 +13,7 @@ nav.navbar.section-navigation
li
= simple_form_for [@volunteer, BillingExpense.new] do |f|
= f.hidden_field :volunteer_id, value: @volunteer.id
= f.button :submits
= f.button :submit
- if @volunteer.billing_expenses.any?
li = button_link t_title(:index, BillingExpense), volunteer_billing_expenses_path(@volunteer)
- if @volunteer.assignments?
......
......@@ -8,7 +8,6 @@ class BillingExpensesTest < ApplicationSystemTestCase
create :hour, volunteer: @volunteer, assignment: assignment
login_as superadmin
visit volunteer_path(@volunteer)
click_link 'New Billing expense'
click_button 'Create Billing expense'
end
......@@ -17,10 +16,7 @@ class BillingExpensesTest < ApplicationSystemTestCase
end
test 'no duplicate billing expenses' do
click_link 'New Billing expense'
click_button 'Create Billing expense'
assert_no_difference 'BillingExpense.count' do
click_link 'New Billing expense'
click_button 'Create Billing expense'
assert page.has_text? 'This billing expense was already created'
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment