summaryrefslogtreecommitdiff
path: root/spec/workers/update_merge_requests_worker_spec.rb
blob: fb12086c2f46a71e95035525d9fd102ca10619bc (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe UpdateMergeRequestsWorker do
  include RepoHelpers

  let(:project) { create(:project, :repository) }
  let(:user) { create(:user) }

  subject { described_class.new }

  describe '#perform' do
    let(:oldrev) { "123456" }
    let(:newrev) { "789012" }
    let(:ref)    { "refs/heads/test" }

    def perform
      subject.perform(project.id, user.id, oldrev, newrev, ref)
    end

    it 'executes MergeRequests::RefreshService with expected values' do
      expect_next_instance_of(MergeRequests::RefreshService, project, user) do |refresh_service|
        expect(refresh_service).to receive(:execute).with(oldrev, newrev, ref)
      end

      perform
    end
  end
end