summaryrefslogtreecommitdiff
path: root/spec/views/projects/environments/terminal.html.haml_spec.rb
blob: d2e4722522651bc7f4513f9f5febad167b324dcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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