diff options
author | Stan Hu <stanhu@gmail.com> | 2015-07-15 01:20:38 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-07-17 16:54:32 +0300 |
commit | df2bb60f90315a77718b9122e9d06f5655750640 (patch) | |
tree | a076cbfdb4f7583cc955af5dbba97a4ecd2205b3 /spec/controllers/projects/milestones_controller_spec.rb | |
parent | c4c41007adf5e3950f8991d4503b699d1e078705 (diff) |
Add support for destroying project milestones
Closes https://github.com/gitlabhq/gitlabhq/issues/1504
Diffstat (limited to 'spec/controllers/projects/milestones_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/milestones_controller_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb new file mode 100644 index 00000000000..d3868c13202 --- /dev/null +++ b/spec/controllers/projects/milestones_controller_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe Projects::MilestonesController do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:milestone) { create(:milestone, project: project) } + let(:issue) { create(:issue, project: project, milestone: milestone) } + + before do + sign_in(user) + project.team << [user, :master] + controller.instance_variable_set(:@project, project) + end + + describe "#destroy" do + it "should remove milestone" do + expect(issue.milestone_id).to eq(milestone.id) + delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.id, format: :js + expect(response).to be_success + expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound) + issue.reload + expect(issue.milestone_id).to eq(nil) + # Check system note left for milestone removal + last_note = project.issues.find(issue.id).notes[-1].note + expect(last_note).to eq('Milestone removed') + end + end +end |