Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2012-05-20 23:06:13 +0400
committerRobb Kidd <robb@thekidds.org>2012-06-20 22:09:46 +0400
commit356430c3c0e8aed3f8c9f2e181aaeaeaa4f1d693 (patch)
tree030a2a378eaeb43689eb615753d30257fc4e48f4 /spec/models/issue_spec.rb
parent02924de3e1555bcd89097353ffb7eb552113b42e (diff)
Add method for an issue to know whether it is being closed
Update IssueObserver to create a Note on the issue its being closed.
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r--spec/models/issue_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 68c05f2edf4..9668f0b23f2 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -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 {