diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/views/projects/environments/terminal.html.haml_spec.rb | 32 |
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 |