summaryrefslogtreecommitdiff
path: root/spec/models/issue_spec.rb
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2012-05-20 14:15:13 -0400
committerRobb Kidd <robb@thekidds.org>2012-06-20 14:09:46 -0400
commit2416e3cb19d6a668fc3274b1ae3382f4119dac1d (patch)
treef980fe7df789eb2e1f7c7e1cf5dd999ea6256a20 /spec/models/issue_spec.rb
parentf6035552e5d83b36f69e1ac7fa4b40ee5f7ab4fb (diff)
downloadgitlab-ce-2416e3cb19d6a668fc3274b1ae3382f4119dac1d.tar.gz
Add new utility method for an issue to know whether it is being reassigned
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r--spec/models/issue_spec.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 791e9cdeb9f..68c05f2edf4 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -20,10 +20,21 @@ describe Issue do
it { Issue.should respond_to :opened }
end
- it { Factory.create(:issue,
- :author => Factory(:user),
- :assignee => Factory(:user),
- :project => Factory.create(:project)).should be_valid }
+ subject { Factory.create(:issue,
+ :author => Factory(:user),
+ :assignee => Factory(:user),
+ :project => Factory.create(:project)) }
+ it { should be_valid }
+
+ describe '#is_being_reassigned?' do
+ it 'returns true if the issue assignee has changed' do
+ subject.assignee = Factory(:user)
+ subject.is_being_reassigned?.should be_true
+ end
+ it 'returns false if the issue assignee has not changed' do
+ subject.is_being_reassigned?.should be_false
+ end
+ end
describe "plus 1" do
let(:project) { Factory(:project) }