2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-11-16 08:39:19 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Milestones::CloseService do
|
2015-11-16 08:39:19 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2015-11-16 08:39:19 -05:00
|
|
|
let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2015-11-16 08:39:19 -05:00
|
|
|
end
|
|
|
|
|
2016-07-11 18:12:31 -04:00
|
|
|
describe '#execute' do
|
2015-11-16 08:39:19 -05:00
|
|
|
before do
|
2017-07-25 13:09:00 -04:00
|
|
|
described_class.new(project, user, {}).execute(milestone)
|
2015-11-16 08:39:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(milestone).to be_valid }
|
|
|
|
it { expect(milestone).to be_closed }
|
|
|
|
|
2017-03-24 19:04:03 -04:00
|
|
|
describe 'event' do
|
2016-10-27 00:48:26 -04:00
|
|
|
let(:event) { Event.recent.first }
|
2015-11-16 08:39:19 -05:00
|
|
|
|
|
|
|
it { expect(event.milestone).to be_truthy }
|
|
|
|
it { expect(event.target).to eq(milestone) }
|
|
|
|
it { expect(event.action_name).to eq('closed') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|