diff --git a/app/views/admin/enterprise_fees/index.html.haml b/app/views/admin/enterprise_fees/index.html.haml index 213923160f..79bd95d755 100644 --- a/app/views/admin/enterprise_fees/index.html.haml +++ b/app/views/admin/enterprise_fees/index.html.haml @@ -26,5 +26,5 @@ .calculator-settings = f.fields_for :calculator do |calculator_form| = preference_fields(enterprise_fee.calculator, calculator_form) - %td TODO + %td= link_to_delete enterprise_fee unless enterprise_fee.new_record? = enterprise_fee_set_form.submit 'Update' diff --git a/spec/requests/admin/enterprise_fees_spec.rb b/spec/requests/admin/enterprise_fees_spec.rb index da4fdb6547..90f7f065d3 100644 --- a/spec/requests/admin/enterprise_fees_spec.rb +++ b/spec/requests/admin/enterprise_fees_spec.rb @@ -58,14 +58,12 @@ feature %q{ login_to_admin_section click_link 'Configuration' click_link 'Enterprise Fees' - binding.pry # And I update the fields for the enterprise fee and click update select 'Foo', from: 'enterprise_fee_set_collection_attributes_0_enterprise_id' select 'Admin', from: 'enterprise_fee_set_collection_attributes_0_fee_type' fill_in 'enterprise_fee_set_collection_attributes_0_name', with: 'Greetings!' select 'Flat Percent', from: 'enterprise_fee_set_collection_attributes_0_calculator_type' - binding.pry click_button 'Update' # Then I should see the updated fields for my fee @@ -75,5 +73,22 @@ feature %q{ page.should have_selector "option[selected]", text: 'Flat Percent' end + scenario "deleting an enterprise fee", js: true do + # Given an enterprise fee + fee = create(:enterprise_fee) + + # When I go to the enterprise fees page + login_to_admin_section + click_link 'Configuration' + click_link 'Enterprise Fees' + + # And I click delete + click_link 'Delete' + page.driver.wait_until(page.driver.browser.switch_to.alert.accept) + + # Then my enterprise fee should have been deleted + visit admin_enterprise_fees_path + page.should_not have_selector "input[value='#{fee.name}']" + end end