From 178cc4910932b134688392247d39a6bc92abde41 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 15 Sep 2017 00:07:38 +0200 Subject: Refs: #4446@0.3h; Integrated Policy Specs of #4442 and adapting them to the needs of #4446 --- .../api_keys/delete_api_key_feature_spec.rb | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spec/features/api_keys/delete_api_key_feature_spec.rb (limited to 'spec/features/api_keys') diff --git a/spec/features/api_keys/delete_api_key_feature_spec.rb b/spec/features/api_keys/delete_api_key_feature_spec.rb new file mode 100644 index 000000000..8d4f57806 --- /dev/null +++ b/spec/features/api_keys/delete_api_key_feature_spec.rb @@ -0,0 +1,34 @@ +RSpec.describe 'New API Key', type: :feature do + login_user + + describe "api_keys#destroy" do + + let!( :api_key ){ create :api_key, name: SecureRandom.uuid, organisation: @user.organisation } + + let( :edit_label ){ "#{api_key.name} : #{api_key.token}" } + let( :destroy_label ){ "Supprimer" } + + it 'complete workflow' do + # /workbenches + visit workbenches_path + # the api_key is visible + click_link edit_label + + # brings us to correct page + expect(page.current_path).to eq(edit_api_key_path(api_key)) + expect(page).to have_content("Supprimer") + # click_link(destroy_label) + + # # check impact on DB + # expect(Api::V1::ApiKey.where(id: api_key.id)).to be_empty + + # # check redirect and changed display + # expect(page.current_path).to eq(workbenches_path) + # # deleted api_key's not shown anymore + # expect( page ).not_to have_content(edit_label) + end + + end + +end + -- cgit v1.2.3