diff options
| author | Robert | 2017-09-14 16:54:48 +0200 | 
|---|---|---|
| committer | Robert | 2017-09-14 16:54:48 +0200 | 
| commit | b3c023584e6d3d73ac1dd4dc01556758d358d391 (patch) | |
| tree | eba2b3fff023f9347b461765c200bba897672b78 /spec/features/api_keys | |
| parent | 53be68710dd7c101172ca9244b9843834a858b4e (diff) | |
| download | chouette-core-b3c023584e6d3d73ac1dd4dc01556758d358d391.tar.bz2 | |
Refs: #4446@0.7438h;   Creation feature speced
Diffstat (limited to 'spec/features/api_keys')
| -rw-r--r-- | spec/features/api_keys/api_keys_new_feature_spec.rb | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/spec/features/api_keys/api_keys_new_feature_spec.rb b/spec/features/api_keys/api_keys_new_feature_spec.rb index 3de329882..eba873691 100644 --- a/spec/features/api_keys/api_keys_new_feature_spec.rb +++ b/spec/features/api_keys/api_keys_new_feature_spec.rb @@ -1,5 +1,38 @@  RSpec.describe 'New API Key', type: :feature do    login_user +  describe "api_keys#create" do + +    let( :create_label ){ "Créer une clé d'API" } +    let( :name_label ){ "Nom" } +    let( :validate_label ){ "Valider" } + +    let( :unique_name ){ SecureRandom.uuid } +    let( :last_api_key ){ Api::V1::ApiKey.last } + + +    it 'complete workflow' do +      # /workbenches +      visit workbenches_path  +      expect(page).to have_link(create_label, href: new_api_key_path) +      # to be created api_key does not exist yet +      expect( page ).not_to have_content(unique_name) + +      # /api_keys/new +      click_link create_label  +      fill_in(name_label, with: unique_name)  +      click_button validate_label + +      # check impact on DB +      expect(last_api_key.name).to eq(unique_name) + +      # check redirect and changed display +      expect(page.current_path).to eq(workbenches_path) +      # to be created api_key exists now +      expect( page ).to have_content(unique_name) +    end + +  end +  end | 
