Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git_tag_push_service_spec.rb « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fcf462edbfc443f384e2acda0bec5da39a61dd86 (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
require 'spec_helper'

describe GitTagPushService do
  let (:user) { create :user }
  let (:project) { create :project }
  let (:service) { GitTagPushService.new }

  before do
    @ref = 'refs/tags/super-tag'
    @oldrev = 'b98a310def241a6fd9c9a9a3e7934c48e498fe81'
    @newrev = 'b19a04f53caeebf4fe5ec2327cb83e9253dc91bb'
  end

  describe 'Git Tag Push Data' do
    before do
      service.execute(project, user, @oldrev, @newrev, @ref)
      @push_data = service.push_data
    end

    subject { @push_data }

    it { is_expected.to include(ref: @ref) }
    it { is_expected.to include(before: @oldrev) }
    it { is_expected.to include(after: @newrev) }
    it { is_expected.to include(user_id: user.id) }
    it { is_expected.to include(user_name: user.name) }
    it { is_expected.to include(project_id: project.id) }

    context 'With repository data' do
      subject { @push_data[:repository] }

      it { is_expected.to include(name: project.name) }
      it { is_expected.to include(url: project.url_to_repo) }
      it { is_expected.to include(description: project.description) }
      it { is_expected.to include(homepage: project.web_url) }
    end
  end

  describe "Web Hooks" do
    context "execute web hooks" do
      it "when pushing tags" do
        expect(project).to receive(:execute_hooks)
        service.execute(project, user, 'oldrev', 'newrev', 'refs/tags/v1.0.0')
      end
    end
  end
end