2015-11-26 14:37:03 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe Milestones::CloseService do
|
2015-11-26 14:37:03 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project) }
|
2015-11-26 14:37:03 +05:30
|
|
|
let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
describe '#execute' do
|
2015-11-26 14:37:03 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
described_class.new(project, user, {}).execute(milestone)
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(milestone).to be_valid }
|
|
|
|
it { expect(milestone).to be_closed }
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'event' do
|
|
|
|
let(:event) { Event.recent.first }
|
2015-11-26 14:37:03 +05:30
|
|
|
|
|
|
|
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
|