summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-05-06 17:10:06 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-05-06 17:10:06 +0000
commit2e6201b13197d03eafecd18d967ba7d55f664e19 (patch)
treea92fa18dda34acc849534a4552fbc889ea261cf1 /spec/views
parentb7c480d7c010ec9dd8e0aa470f8a8010f1f4e6ba (diff)
parente944fd7064b5a04a334b6c500c9ee7db29a46538 (diff)
downloadgitlab-ce-2e6201b13197d03eafecd18d967ba7d55f664e19.tar.gz
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
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/environments/terminal.html.haml_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/views/projects/environments/terminal.html.haml_spec.rb b/spec/views/projects/environments/terminal.html.haml_spec.rb
new file mode 100644
index 00000000000..d2e47225226
--- /dev/null
+++ b/spec/views/projects/environments/terminal.html.haml_spec.rb
@@ -0,0 +1,32 @@
+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