aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorTeddy Wing2017-12-21 18:09:21 +0100
committerTeddy Wing2017-12-21 18:15:55 +0100
commit7c3837d9b5aeac60ce4ea203baba61cd99293a8b (patch)
tree49edd506a3ecdbe5c45b0092129993e13b1f6e22 /spec
parent174d002f2a14df9e2dfd317271882668fa2a90bb (diff)
downloadchouette-core-7c3837d9b5aeac60ce4ea203baba61cd99293a8b.tar.bz2
purchase_windows_spec: Add feature spec for destroy
Check that `PurchaseWindow`s can be destroyed, starting from the `#index` page. Update the i18n key used in the decorator to get the text that appears in the alert when destroying a `PurchaseWindow` so that it correctly corresponds to the one used in the locale file. Refs #5366
Diffstat (limited to 'spec')
-rw-r--r--spec/features/purchase_windows_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/features/purchase_windows_spec.rb b/spec/features/purchase_windows_spec.rb
index 0fa576434..8edc85cc6 100644
--- a/spec/features/purchase_windows_spec.rb
+++ b/spec/features/purchase_windows_spec.rb
@@ -42,5 +42,24 @@ describe "PurchaseWindows", type: :feature do
expect(page).to have_content(expected_name)
end
end
+
+ with_permissions('purchase_windows.destroy') do
+ it "allows users to destroy purchase windows" do
+ name = 'Existing purchase window'
+ create(
+ :purchase_window,
+ referential: first_referential,
+ name: name
+ )
+
+ visit(referential_purchase_windows_path(first_referential.id))
+
+ click_link(name)
+
+ click_link(I18n.t('purchase_windows.actions.destroy'))
+
+ expect(page).to_not have_content(name)
+ end
+ end
end
end