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-03-27 17:14:01 -04:00
|
|
|
let(:project) { create(:empty_project) }
|
2015-11-16 08:39:19 -05:00
|
|
|
let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
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
|