BigW Consortium Gitlab

browse_files_spec.rb 1.4 KB
Newer Older
1 2
require 'spec_helper'

3
feature 'user browses project', :js do
4
  let(:project) { create(:project, :repository) }
5 6 7
  let(:user) { create(:user) }

  before do
8
    project.add_master(user)
9
    sign_in(user)
10
    visit project_tree_path(project, project.default_branch)
11 12 13 14
  end

  scenario "can see blame of '.gitignore'" do
    click_link ".gitignore"
Stan Hu committed
15
    click_link 'Blame'
Douwe Maan committed
16

17 18 19 20
    expect(page).to have_content "*.rb"
    expect(page).to have_content "Dmitriy Zaporozhets"
    expect(page).to have_content "Initial commit"
  end
21 22 23 24 25 26

  scenario 'can see raw content of LFS pointer with LFS disabled' do
    allow_any_instance_of(Project).to receive(:lfs_enabled?).and_return(false)
    click_link 'files'
    click_link 'lfs'
    click_link 'lfs_object.iso'
27
    wait_for_requests
28 29 30 31 32 33

    expect(page).not_to have_content 'Download (1.5 MB)'
    expect(page).to have_content 'version https://git-lfs.github.com/spec/v1'
    expect(page).to have_content 'oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
    expect(page).to have_content 'size 1575078'
  end
34 35 36 37 38

  scenario 'can see last commit for current directory' do
    last_commit = project.repository.last_commit_for_path(project.default_branch, 'files')

    click_link 'files'
39
    wait_for_requests
40 41 42 43 44 45

    page.within('.blob-commit-info') do
      expect(page).to have_content last_commit.short_id
      expect(page).to have_content last_commit.author_name
    end
  end
46
end