Add method for an issue to know whether it is being closed

Update IssueObserver to create a Note on the issue its being closed.
This commit is contained in:
Robb Kidd 2012-05-20 15:06:13 -04:00
parent 02924de3e1
commit 356430c3c0
4 changed files with 56 additions and 10 deletions

View file

@ -36,6 +36,25 @@ describe Issue do
end
end
describe '#is_being_closed?' do
it 'returns true if the closed attribute has changed and is now true' do
subject.closed = true
subject.is_being_closed?.should be_true
end
it 'returns false if the closed attribute has changed and is now false' do
issue = Factory.create(:issue,
:closed => true,
:author => Factory(:user),
:assignee => Factory(:user),
:project => Factory.create(:project))
issue.closed = false
issue.is_being_closed?.should be_false
end
it 'returns false if the closed attribute has not changed' do
subject.is_being_closed?.should be_false
end
end
describe "plus 1" do
let(:project) { Factory(:project) }
subject {