Commit 2e6201b1 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix/gb/hide-environment-external-url-btn-when-not-provided' into 'master'

Hide environment external URL button if not defined

Closes #30832

See merge request !11029
parents b7c480d7 e944fd70
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
.col-sm-6 .col-sm-6
.nav-controls .nav-controls
- if @environment.external_url.present?
= link_to @environment.external_url, class: 'btn btn-default', target: '_blank', rel: 'noopener noreferrer nofollow' do = link_to @environment.external_url, class: 'btn btn-default', target: '_blank', rel: 'noopener noreferrer nofollow' do
= icon('external-link') = icon('external-link')
= render 'projects/deployments/actions', deployment: @environment.last_deployment = render 'projects/deployments/actions', deployment: @environment.last_deployment
......
---
title: Hide external environment URL button on terminal page if URL is not defined
merge_request: 11029
author:
require 'spec_helper'
describe 'projects/environments/terminal' do
let!(:environment) { create(:environment, :with_review_app) }
before do
assign(:environment, environment)
assign(:project, environment.project)
allow(view).to receive(:can?).and_return(true)
end
context 'when environment has external URL' do
it 'shows external URL button' do
environment.update_attribute(:external_url, 'https://gitlab.com')
render
expect(rendered).to have_link(nil, href: 'https://gitlab.com')
end
end
context 'when environment does not have external URL' do
it 'shows external URL button' do
environment.update_attribute(:external_url, nil)
render
expect(rendered).not_to have_link(nil, href: 'https://gitlab.com')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment