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:
Diffstat (limited to 'spec/models/concerns/issuable_spec.rb')
-rw-r--r--spec/models/concerns/issuable_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index 9574796a945..4522206fab1 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -44,6 +44,34 @@ describe Issue, "Issuable" do
it { expect(described_class).to respond_to(:assigned) }
end
+ describe 'author_name' do
+ it 'is delegated to author' do
+ expect(issue.author_name).to eq issue.author.name
+ end
+
+ it 'returns nil when author is nil' do
+ issue.author_id = nil
+ issue.save(validate: false)
+
+ expect(issue.author_name).to eq nil
+ end
+ end
+
+ describe 'assignee_name' do
+ it 'is delegated to assignee' do
+ issue.update!(assignee: create(:user))
+
+ expect(issue.assignee_name).to eq issue.assignee.name
+ end
+
+ it 'returns nil when assignee is nil' do
+ issue.assignee_id = nil
+ issue.save(validate: false)
+
+ expect(issue.assignee_name).to eq nil
+ end
+ end
+
describe "before_save" do
describe "#update_cache_counts" do
context "when previous assignee exists" do