2015-11-26 14:37:03 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
describe Milestones::CloseService, services: true do
|
2015-11-26 14:37:03 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
end
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
describe '#execute' do
|
2015-11-26 14:37:03 +05:30
|
|
|
before do
|
|
|
|
Milestones::CloseService.new(project, user, {}).execute(milestone)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(milestone).to be_valid }
|
|
|
|
it { expect(milestone).to be_closed }
|
|
|
|
|
|
|
|
describe :event do
|
|
|
|
let(:event) { Event.first }
|
|
|
|
|
|
|
|
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
|