about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-05-30 01:03:15 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-29 18:03:15 +0200
commit52ae83d00862eebe0a79389b1808c034998a1584 (patch)
tree9ce72deab1dd4d0e0de2d58f689e4ce73595e1c7
parent5aacd9d4c79ee3f13cfdf30b9e16e145131a5957 (diff)
Spec Activitystreams2BuilderHelper (#3413)
-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