BigW Consortium Gitlab

deleted_source_branch_spec.rb 1.27 KB
Newer Older
1 2
require 'spec_helper'

3 4 5
# This test serves as a regression test for a bug that caused an error
# message to be shown by JavaScript when the source branch was deleted.
# Please do not remove "js: true".
6
describe 'Deleted source branch', feature: true, js: true do
Mike Greiling committed
7 8
  include WaitForAjax

9 10 11 12 13 14 15 16 17
  let(:user) { create(:user) }
  let(:merge_request) { create(:merge_request) }

  before do
    login_as user
    merge_request.project.team << [user, :master]
    merge_request.update!(source_branch: 'this-branch-does-not-exist')
    visit namespace_project_merge_request_path(
      merge_request.project.namespace,
Mike Greiling committed
18 19
      merge_request.project,
      merge_request
20 21 22 23 24 25 26 27 28
    )
  end

  it 'shows a message about missing source branch' do
    expect(page).to have_content(
      'Source branch this-branch-does-not-exist does not exist'
    )
  end

Mike Greiling committed
29
  it 'still contains Discussion, Commits and Changes tabs' do
30
    within '.merge-request-details' do
Mike Greiling committed
31 32 33
      expect(page).to have_content('Discussion')
      expect(page).to have_content('Commits')
      expect(page).to have_content('Changes')
34
    end
Mike Greiling committed
35 36 37 38 39 40

    click_on 'Changes'
    wait_for_ajax

    expect(page).to have_selector('.diffs.tab-pane .nothing-here-block')
    expect(page).to have_content('Nothing to merge from this-branch-does-not-exist into feature')
41 42
  end
end