aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/api_keys
diff options
context:
space:
mode:
authorRobert2017-09-14 23:57:15 +0200
committerRobert2017-09-14 23:57:15 +0200
commit402ba92a128e697fe6da754ee3454c315afebacb (patch)
treeeb1ed05a4679761257ebf7c791edb36698f9a089 /spec/features/api_keys
parent9c9667baba6cc265b4756eb40ac35cdac3b7439d (diff)
downloadchouette-core-402ba92a128e697fe6da754ee3454c315afebacb.tar.bz2
Refs: #4446@1h; Api Keys Edit feature speced
Diffstat (limited to 'spec/features/api_keys')
-rw-r--r--spec/features/api_keys/edit_api_key_feature_spec.rb39
-rw-r--r--spec/features/api_keys/new_api_key_feature_spec.rb (renamed from spec/features/api_keys/api_keys_new_feature_spec.rb)0
2 files changed, 39 insertions, 0 deletions
diff --git a/spec/features/api_keys/edit_api_key_feature_spec.rb b/spec/features/api_keys/edit_api_key_feature_spec.rb
new file mode 100644
index 000000000..411c11aaf
--- /dev/null
+++ b/spec/features/api_keys/edit_api_key_feature_spec.rb
@@ -0,0 +1,39 @@
+RSpec.describe 'New API Key', type: :feature do
+ login_user
+
+ describe "api_keys#edit" do
+
+ let!( :api_key ){ create :api_key, name: SecureRandom.uuid, organisation: @user.organisation }
+
+ let( :edit_label ){ "#{api_key.name} : #{api_key.token}" }
+ let( :name_label ){ "Nom" }
+ let( :validate_label ){ "Valider" }
+
+ let( :unique_name ){ SecureRandom.uuid }
+
+ it 'complete workflow' do
+ # /workbenches
+ visit workbenches_path
+ # api_key's new name does not exist yet
+ expect( page ).not_to have_content(unique_name)
+ # 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))
+ fill_in(name_label, with: unique_name)
+ click_button(validate_label)
+
+ # check impact on DB
+ expect(api_key.reload.name).to eq(unique_name)
+
+ # check redirect and changed display
+ expect(page.current_path).to eq(workbenches_path)
+ # changed api_key's name exists now
+ expect( page ).to have_content(unique_name)
+ end
+
+ end
+
+end
+
diff --git a/spec/features/api_keys/api_keys_new_feature_spec.rb b/spec/features/api_keys/new_api_key_feature_spec.rb
index eba873691..eba873691 100644
--- a/spec/features/api_keys/api_keys_new_feature_spec.rb
+++ b/spec/features/api_keys/new_api_key_feature_spec.rb