summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-02 13:21:06 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-02 13:21:06 +0200
commit48bb8921240387ce7d8f9401c98e13a9b3d0100f (patch)
tree92b421a137b3d4b321ec171c790b995273525cb6 /spec/views
parent6068b863c66f785bea0a56881d60e8c23da08a0b (diff)
downloadgitlab-ce-48bb8921240387ce7d8f9401c98e13a9b3d0100f.tar.gz
Hide environment external URL button if not defined
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