2015-11-16 08:39:19 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 05:55:49 -05:00
|
|
|
describe Milestones::CloseService, services: true 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
|
|
|
|
Milestones::CloseService.new(project, user, {}).execute(milestone)
|
|
|
|
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
|