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:
authorJacopo <beschi.jacopo@gmail.com>2017-04-10 18:51:15 +0300
committerJacopo <beschi.jacopo@gmail.com>2017-04-28 15:24:32 +0300
commit60e9405bb71cef461a4bc2d6a5d706a558a9dc32 (patch)
treeacde27624d0e76f7384010f1d4e9c615db7e2e51 /spec/models/todo_spec.rb
parent9a905e1b9f9575bb8d637560cb3c59fd82079d2d (diff)
Improve text on todo list when the todo action comes from yourself
Improved todo message when an issue is assigned to yourself. - The new message when an user assign to himself an issue or a mr is: "You assigned issue xx to yourself" - The new message when an user adds a todo to himself is: "You added a todo for issue xx" - The new message when and user mention himself is: "You mentioned yourself on issue xx" - The new message when an user directly address himself is: "You directly addressed yourself on issue xx" - The new message when an user mark himself as an approver is: "You set yourself as an approver for merge request xx"
Diffstat (limited to 'spec/models/todo_spec.rb')
-rw-r--r--spec/models/todo_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb
index 581305ad39f..3f80e1ac534 100644
--- a/spec/models/todo_spec.rb
+++ b/spec/models/todo_spec.rb
@@ -125,4 +125,50 @@ describe Todo, models: true do
expect(subject.target_reference).to eq issue.to_reference(full: true)
end
end
+
+ describe '#self_added?' do
+ let(:user_1) { build(:user) }
+
+ before do
+ subject.user = user_1
+ end
+
+ it 'is true when the user is the author' do
+ subject.author = user_1
+
+ expect(subject).to be_self_added
+ end
+
+ it 'is false when the user is not the author' do
+ subject.author = build(:user)
+
+ expect(subject).not_to be_self_added
+ end
+ end
+
+ describe '#self_assigned?' do
+ let(:user_1) { build(:user) }
+
+ before do
+ subject.user = user_1
+ subject.author = user_1
+ subject.action = Todo::ASSIGNED
+ end
+
+ it 'is true when todo is ASSIGNED and self_added' do
+ expect(subject).to be_self_assigned
+ end
+
+ it 'is false when the todo is not ASSIGNED' do
+ subject.action = Todo::MENTIONED
+
+ expect(subject).not_to be_self_assigned
+ end
+
+ it 'is false when todo is not self_added' do
+ subject.author = build(:user)
+
+ expect(subject).not_to be_self_assigned
+ end
+ end
end