summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/repository/clone_spec.rb
blob: 521bd955857e8c2a14ab5a6134c9d5e82b92cada (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
module QA
  feature 'clone code from the repository' do
    context 'with regular account over http' do
      given(:location) do
        Page::Project::Show.act do
          choose_repository_clone_http
          repository_location
        end
      end

      before do
        Page::Main::Entry.act { sign_in_using_credentials }

        Scenario::Gitlab::Project::Create.perform do |scenario|
          scenario.name = 'project-with-code'
          scenario.description = 'project for git clone tests'
        end

        Git::Repository.perform do |repository|
          repository.location = location
          repository.use_default_credentials

          repository.act do
            clone
            configure_identity('GitLab QA', 'root@gitlab.com')
            commit_file('test.rb', 'class Test; end', 'Add Test class')
            commit_file('README.md', '# Test', 'Add Readme')
            push_changes
          end
        end
      end

      scenario 'user performs a deep clone' do
        Git::Repository.perform do |repository|
          repository.location = location
          repository.use_default_credentials

          repository.act { clone }

          expect(repository.commits.size).to eq 2
        end
      end

      scenario 'user performs a shallow clone' do
        Git::Repository.perform do |repository|
          repository.location = location
          repository.use_default_credentials

          repository.act { shallow_clone }

          expect(repository.commits.size).to eq 1
          expect(repository.commits.first).to include 'Add Readme'
        end
      end
    end
  end
end