summaryrefslogtreecommitdiff
path: root/spec/requests/api/resource_milestone_events_spec.rb
blob: 5c81c2180d73f776aa984a7d8422834868423b1a (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe API::ResourceMilestoneEvents do
  let!(:user) { create(:user) }
  let!(:project) { create(:project, :public, namespace: user.namespace) }
  let!(:milestone) { create(:milestone, project: project) }

  before do
    project.add_developer(user)
  end

  context 'when eventable is an Issue' do
    it_behaves_like 'resource_milestone_events API', 'projects', 'issues', 'iid' do
      let(:parent) { project }
      let(:eventable) { create(:issue, project: project, author: user) }
    end
  end

  context 'when eventable is a Merge Request' do
    it_behaves_like 'resource_milestone_events API', 'projects', 'merge_requests', 'iid' do
      let(:parent) { project }
      let(:eventable) { create(:merge_request, source_project: project, target_project: project, author: user) }
    end
  end
end