about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/activitystreams2_builder_helper_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/helpers/activitystreams2_builder_helper_spec.rb b/spec/helpers/activitystreams2_builder_helper_spec.rb
new file mode 100644
index 000000000..612ce6ad2
--- /dev/null
+++ b/spec/helpers/activitystreams2_builder_helper_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Activitystreams2BuilderHelper, type: :helper do
+  it 'returns display name if present' do
+    account = Fabricate(:account, display_name: 'display name', username: 'username')
+    expect(account_name(account)).to eq 'display name'
+  end
+
+  it 'returns username if display name is not present' do
+    account = Fabricate(:account, display_name: '', username: 'username')
+    expect(account_name(account)).to eq 'username'
+  end
+end