From ce4f6b731e27bd64433aff78c237cd993b7559e8 Mon Sep 17 00:00:00 2001 From: Cyril Mougel Date: Tue, 15 Oct 2013 10:05:41 +0200 Subject: [PATCH] Fix issue of failed page to create apps The page to create an apps failed. Fix #586 --- app/views/apps/_fields.html.haml | 9 +++++---- spec/acceptance/app_regenerate_api_key_spec.rb | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/apps/_fields.html.haml b/app/views/apps/_fields.html.haml index 46df9a39a..ca9bbab6d 100644 --- a/app/views/apps/_fields.html.haml +++ b/app/views/apps/_fields.html.haml @@ -4,10 +4,11 @@ = f.label :name = f.text_field :name -%div - %label Api Key - %span= app.api_key - = link_to t('.regenerate_api_key'), regenerate_api_key_app_path(app), :class => 'button', :method => 'post' +- unless app.new_record? + %div + %label Api Key + %span= app.api_key + = link_to t('.regenerate_api_key'), regenerate_api_key_app_path(app), :class => 'button', :method => 'post' %div = f.label :repository_branch = f.text_field :repository_branch, :placeholder => "master" diff --git a/spec/acceptance/app_regenerate_api_key_spec.rb b/spec/acceptance/app_regenerate_api_key_spec.rb index a5494e0c1..e6062c300 100644 --- a/spec/acceptance/app_regenerate_api_key_spec.rb +++ b/spec/acceptance/app_regenerate_api_key_spec.rb @@ -17,6 +17,9 @@ }.to change { app.reload.api_key } + click_link I18n.t('shared.navigation.apps') + click_link I18n.t('apps.index.new_app') + expect(page).to_not have_button I18n.t('apps.fields.regenerate_api_key') end scenario "a user cannot access to edit page" do