From 174d002f2a14df9e2dfd317271882668fa2a90bb Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 21 Dec 2017 18:07:24 +0100 Subject: purchase_windows_spec: Add feature test for PurchaseWindow update Test that `PurchaseWindow`s can be updated starting from the `#index` page. Refs #5366 --- spec/features/purchase_windows_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/features/purchase_windows_spec.rb b/spec/features/purchase_windows_spec.rb index c30be48a3..0fa576434 100644 --- a/spec/features/purchase_windows_spec.rb +++ b/spec/features/purchase_windows_spec.rb @@ -19,5 +19,28 @@ describe "PurchaseWindows", type: :feature do expect(page).to have_content(name) end end + + with_permissions('purchase_windows.update') do + it "allows users to update purchase windows" do + actual_name = 'Existing purchase window' + expected_name = 'Updated purchase window' + create( + :purchase_window, + referential: first_referential, + name: actual_name + ) + + visit(referential_purchase_windows_path(first_referential.id)) + + click_link(actual_name) + + click_link(I18n.t('purchase_windows.actions.edit')) + fill_in('purchase_window[name]', with: expected_name) + + click_button(I18n.t('actions.submit')) + + expect(page).to have_content(expected_name) + end + end end end -- cgit v1.2.3