about summary refs log tree commit diff
path: root/spec/helpers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-12-09 13:28:09 +0100
committerThibaut Girka <thib@sitedethib.com>2018-12-09 16:08:04 +0100
commite7f1bfdc2d528f137299ba0c3ab2a30f2f91f53c (patch)
tree2693ffce4d340a9b77a7ca52c856aaae7af8c913 /spec/helpers
parente3682c9c1750e5e7e5d2f817e29f6760a18400ca (diff)
parent81bda7d67c984c9bfcb5bca94e50cec6405b492e (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/javascript/packs/public.js
- app/models/user.rb
- config/settings.yml
- db/schema.rb

Moved public.js changes to settings.js.
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/admin/account_moderation_notes_helper_spec.rb62
1 files changed, 51 insertions, 11 deletions
diff --git a/spec/helpers/admin/account_moderation_notes_helper_spec.rb b/spec/helpers/admin/account_moderation_notes_helper_spec.rb
index 01b60c851..c07f6c4b8 100644
--- a/spec/helpers/admin/account_moderation_notes_helper_spec.rb
+++ b/spec/helpers/admin/account_moderation_notes_helper_spec.rb
@@ -1,15 +1,55 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
-# Specs in this file have access to a helper object that includes
-# the Admin::AccountModerationNotesHelper. For example:
-#
-# describe Admin::AccountModerationNotesHelper do
-#   describe "string concat" do
-#     it "concats two strings with spaces" do
-#       expect(helper.concat_strings("this","that")).to eq("this that")
-#     end
-#   end
-# end
 RSpec.describe Admin::AccountModerationNotesHelper, type: :helper do
-  pending "add some examples to (or delete) #{__FILE__}"
+  include StreamEntriesHelper
+
+  describe '#admin_account_link_to' do
+    context 'account is nil' do
+      let(:account) { nil }
+
+      it 'returns nil' do
+        expect(helper.admin_account_link_to(account)).to be_nil
+      end
+    end
+
+    context 'with account' do
+      let(:account) { Fabricate(:account) }
+
+      it 'calls #link_to' do
+        expect(helper).to receive(:link_to).with(
+          admin_account_path(account.id),
+          class: name_tag_classes(account),
+          title: account.acct
+        )
+
+        helper.admin_account_link_to(account)
+      end
+    end
+  end
+
+  describe '#admin_account_inline_link_to' do
+    context 'account is nil' do
+      let(:account) { nil }
+
+      it 'returns nil' do
+        expect(helper.admin_account_inline_link_to(account)).to be_nil
+      end
+    end
+
+    context 'with account' do
+      let(:account) { Fabricate(:account) }
+
+      it 'calls #link_to' do
+        expect(helper).to receive(:link_to).with(
+          admin_account_path(account.id),
+          class: name_tag_classes(account, true),
+          title: account.acct
+        )
+
+        helper.admin_account_inline_link_to(account)
+      end
+    end
+  end
 end