summaryrefslogtreecommitdiff
path: root/spec/models/note_spec.rb
diff options
context:
space:
mode:
authorRaffael Schmid <raf@nine.ch>2014-01-23 10:55:26 +0100
committerRaffael Schmid <raf@nine.ch>2014-01-23 10:55:26 +0100
commit7863319b97498a7621815cfe5691794ecb86b8c5 (patch)
tree5ae991fe7543bcb91e9257242e87849538b33214 /spec/models/note_spec.rb
parent568d1c27c5a1b4d6749943240cdba2625eee2b6e (diff)
parent68590fddd860c5d840d8f04314ed11f0d02ddd44 (diff)
downloadgitlab-ce-7863319b97498a7621815cfe5691794ecb86b8c5.tar.gz
Merge branch 'master' into dont-depend-on-appid-and-appsecret
* master: (238 commits) Version 6.5.1 Fix selectbox when submit MR from fork to origin Fix HELP layout No need for code tag here. Spelling mistake and add links. Warn against RVM. Remove GitHub mention because we also have a GitLab issue tracker now. Replace 6.0-to-6.4.md with 6.0-to-6.5.md Add public assets to gitignore Version 6.5.0 Use 6-5 branch in installation docs Remove deprecated twitter handle. Further explain userPrincipalName settings Update from 6.4 to 6.5 guide Explain how to use AD userPrincipalName for logins More entries to CHANGELOG. Version to rc1 Rephrase LDAP check script output add O'Reilly sponsorship in CHANGELOG Fix select2 css for drop above style Rename "Website url" labels to "Website" ...
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 55b264ce8cf..b86603dd4ac 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -180,6 +180,31 @@ describe Note do
end
end
+ describe '#create_assignee_change_note' do
+ let(:project) { create(:project) }
+ let(:thing) { create(:issue, project: project) }
+ let(:author) { create(:user) }
+ let(:assignee) { create(:user) }
+
+ subject { Note.create_assignee_change_note(thing, project, author, assignee) }
+
+ context 'creates and saves a Note' do
+ it { should be_a Note }
+ its(:id) { should_not be_nil }
+ end
+
+ its(:noteable) { should == thing }
+ its(:project) { should == thing.project }
+ its(:author) { should == author }
+ its(:note) { should =~ /Reassigned to @#{assignee.username}/ }
+
+ context 'assignee is removed' do
+ let(:assignee) { nil }
+
+ its(:note) { should =~ /Assignee removed/ }
+ end
+ end
+
describe '#create_cross_reference_note' do
let(:project) { create(:project_with_code) }
let(:author) { create(:user) }
@@ -252,6 +277,7 @@ describe Note do
let(:issue) { create(:issue, project: project) }
let(:other) { create(:issue, project: project) }
let(:author) { create(:user) }
+ let(:assignee) { create(:user) }
it 'should recognize user-supplied notes as non-system' do
@note = create(:note_on_issue)
@@ -267,6 +293,11 @@ describe Note do
@note = Note.create_cross_reference_note(issue, other, author, project)
@note.should be_system
end
+
+ it 'should identify assignee-change notes as system notes' do
+ @note = Note.create_assignee_change_note(issue, project, author, assignee)
+ @note.should be_system
+ end
end
describe :authorization do