summaryrefslogtreecommitdiff
path: root/spec/features/projects/show/user_sees_readme_spec.rb
blob: 6a5b9472be89981f4eb8119ef274e37f9905b8e1 (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
33
34
35
36
37
38
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Projects > Show > User sees README' do
  let_it_be(:user) { create(:user) }
  let_it_be(:project) { create(:project, :repository, :public) }

  it 'shows the project README', :js do
    visit project_path(project)
    wait_for_requests

    page.within('.readme-holder') do
      expect(page).to have_content 'testme'
    end
  end

  context 'obeying robots.txt' do
    before do
      Gitlab::Testing::RobotsBlockerMiddleware.block_requests!
    end

    after do
      Gitlab::Testing::RobotsBlockerMiddleware.allow_requests!
    end

    # For example, see this regression we had in
    # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39520
    it 'does not block the requests necessary to load the project README', :js do
      visit project_path(project)
      wait_for_requests

      page.within('.readme-holder') do
        expect(page).to have_content 'testme'
      end
    end
  end
end