BigW Consortium Gitlab

diffs_spec.rb 1.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
require 'spec_helper'

feature 'Diffs URL', js: true, feature: true do
  before do
    login_as :admin
    @merge_request = create(:merge_request)
    @project = @merge_request.source_project
  end

  context 'when visit with */* as accept header' do
    before(:each) do
      page.driver.add_header('Accept', '*/*')
    end

    it 'renders the notes' do
      create :note_on_merge_request, project: @project, noteable: @merge_request, note: 'Rebasing with master'

      visit diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)

      # Load notes and diff through AJAX
      expect(page).to have_css('.note-text', visible: false, text: 'Rebasing with master')
      expect(page).to have_css('.diffs.tab-pane.active')
    end
  end
25 26 27 28 29 30 31 32 33 34 35 36 37 38

  context 'when merge request has overflow' do
    it 'displays warning' do
      allow_any_instance_of(MergeRequestDiff).to receive(:overflow?).and_return(true)
      allow(Commit).to receive(:max_diff_options).and_return(max_files: 20, max_lines: 20)

      visit diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)

      page.within('.alert') do
        expect(page).to have_text("Too many changes to show. Plain diff Email patch To preserve
          performance only 3 of 3+ files are displayed.")
      end
    end
  end
39
end