From a08e724476f47b85de9bb334eeadaf882a7a23ee Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 25 Mar 2016 02:13:30 +0100 Subject: Fix subscriptions:clear task, refactor feeds, refactor streamable activites and atom feed generation to some extent, as well as the way mentions are stored --- spec/helpers/application_helper_spec.rb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'spec/helpers') diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index ca38c792c..30b3653ee 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -30,6 +30,29 @@ RSpec.describe ApplicationHelper, type: :helper do end describe '#linkify' do - pending + let(:alice) { Fabricate(:account, username: 'alice') } + let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', url: 'http://example.com/bob') } + + it 'turns mention of remote user into link' do + status = Fabricate(:status, text: 'Hello @bob@example.com', account: bob) + status.mentions.create(account: bob) + expect(helper.linkify(status)).to match('@bob@example.com') + end + + it 'turns mention of local user into link' do + status = Fabricate(:status, text: 'Hello @alice', account: bob) + status.mentions.create(account: alice) + expect(helper.linkify(status)).to match('@alice') + end + end + + describe '#account_from_mentions' do + let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') } + let(:status) { Fabricate(:status, text: 'Hello @bob@example.com', account: bob) } + let(:mentions) { [Mention.create(status: status, account: bob)] } + + it 'returns account' do + expect(helper.account_from_mentions('bob@example.com', mentions)).to eq bob + end end end -- cgit