From 53850bce9396b15c432ac808647a26b204f55db7 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 11 Apr 2017 13:31:22 -0400 Subject: Remove unused AtomBuilderHelper (#1364) This was used in the views/atom/user_stream.xml.ruby file, which no longer is used. --- spec/helpers/atom_builder_helper_spec.rb | 187 ------------------------------- 1 file changed, 187 deletions(-) delete mode 100644 spec/helpers/atom_builder_helper_spec.rb (limited to 'spec/helpers') diff --git a/spec/helpers/atom_builder_helper_spec.rb b/spec/helpers/atom_builder_helper_spec.rb deleted file mode 100644 index 0aca58ee7..000000000 --- a/spec/helpers/atom_builder_helper_spec.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'rails_helper' - -RSpec.describe AtomBuilderHelper, type: :helper do - describe '#stream_updated_at' do - pending - end - - describe '#entry' do - it 'creates an entry' do - expect(used_in_builder { |xml| helper.entry(xml) }).to match '' - end - end - - describe '#feed' do - it 'creates a feed' do - expect(used_in_builder { |xml| helper.feed(xml) }).to match '' - end - end - - describe '#unique_id' do - it 'creates an id' do - time = Time.now - expect(used_in_builder { |xml| helper.unique_id(xml, time, 1, 'Status') }).to match "#{TagManager.instance.unique_tag(time, 1, 'Status')}" - end - end - - describe '#simple_id' do - it 'creates an id' do - expect(used_in_builder { |xml| helper.simple_id(xml, 1) }).to match '1' - end - end - - describe '#published_at' do - it 'creates a published tag' do - time = Time.now - expect(used_in_builder { |xml| helper.published_at(xml, time) }).to match "#{time.iso8601}" - end - end - - describe '#updated_at' do - it 'creates an updated tag' do - time = Time.now - expect(used_in_builder { |xml| helper.updated_at(xml, time) }).to match "#{time.iso8601}" - end - end - - describe '#verb' do - it 'creates an entry' do - expect(used_with_namespaces { |xml| helper.verb(xml, :post) }).to match 'http://activitystrea.ms/schema/1.0/post' - end - end - - describe '#content' do - it 'creates a content' do - expect(used_in_builder { |xml| helper.content(xml, 'foo') }).to match 'foo' - end - end - - describe '#title' do - it 'creates a title' do - expect(used_in_builder { |xml| helper.title(xml, 'foo') }).to match 'foo' - end - end - - describe '#author' do - it 'creates an author' do - expect(used_in_builder { |xml| helper.author(xml) }).to match '' - end - end - - describe '#target' do - it 'creates a target' do - expect(used_with_namespaces { |xml| helper.target(xml) }).to match '' - end - end - - describe '#object_type' do - it 'creates an object type' do - expect(used_with_namespaces { |xml| helper.object_type(xml, :person) }).to match 'http://activitystrea.ms/schema/1.0/person' - end - end - - describe '#uri' do - it 'creates a uri' do - expect(used_in_builder { |xml| helper.uri(xml, 1) }).to match '1' - end - end - - describe '#name' do - it 'creates a name' do - expect(used_in_builder { |xml| helper.name(xml, 1) }).to match '1' - end - end - - describe '#summary' do - it 'creates a summary' do - expect(used_in_builder { |xml| helper.summary(xml, 1) }).to match '1' - end - end - - describe '#subtitle' do - it 'creates a subtitle' do - expect(used_in_builder { |xml| helper.subtitle(xml, 1) }).to match '1' - end - end - - describe '#link_alternate' do - it 'creates a link' do - expect(used_in_builder { |xml| helper.link_alternate(xml, 1) }).to match '' - end - end - - describe '#link_self' do - it 'creates a link' do - expect(used_in_builder { |xml| helper.link_self(xml, 1) }).to match '' - end - end - - describe '#link_hub' do - it 'creates a link' do - expect(used_in_builder { |xml| helper.link_hub(xml, 1) }).to match '' - end - end - - describe '#link_salmon' do - it 'creates a link' do - expect(used_in_builder { |xml| helper.link_salmon(xml, 1) }).to match '' - end - end - - describe '#portable_contact' do - let(:account) { Fabricate(:account, username: 'alice', display_name: 'Alice in Wonderland') } - - it 'creates portable contacts entries' do - expect(used_with_namespaces { |xml| helper.portable_contact(xml, account) }).to match 'Alice in Wonderland' - end - end - - describe '#in_reply_to' do - it 'creates a thread' do - expect(used_with_namespaces { |xml| helper.in_reply_to(xml, 'uri', 'url') }).to match '' - end - end - - describe '#link_mention' do - let(:account) { Fabricate(:account, username: 'alice') } - - it 'creates a link' do - expect(used_in_builder { |xml| helper.link_mention(xml, account) }).to match '' - end - end - - describe '#include_author' do - pending - end - - describe '#include_entry' do - pending - end - - describe '#link_avatar' do - let(:account) { Fabricate(:account, username: 'alice') } - - it 'creates a link' do - expect(used_with_namespaces { |xml| helper.link_avatar(xml, account) }).to match '' - end - end - - describe '#link_enclosure' do - pending - end - - describe '#logo' do - it 'creates a logo' do - expect(used_in_builder { |xml| helper.logo(xml, 1) }).to match '1' - end - end - - def used_in_builder(&block) - builder = Nokogiri::XML::Builder.new(&block) - builder.doc.root.to_xml - end - - def used_with_namespaces(&block) - used_in_builder { |xml| helper.entry(xml, true, &block) } - end -end -- cgit From e60286a344a8ce9aae96ec36ae60e3dcd582efba Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 11 Apr 2017 13:32:02 -0400 Subject: Remove unused methods from StreamEntriesHelper (#1365) Removes: - avatar_for_status_url - relative_time - reblogged_by_me_class - favourited_by_me_class --- app/helpers/stream_entries_helper.rb | 16 ---------------- spec/helpers/stream_entries_helper_spec.rb | 16 ---------------- 2 files changed, 32 deletions(-) (limited to 'spec/helpers') diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 38e63ed8d..d5cc004b0 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -9,10 +9,6 @@ module StreamEntriesHelper "@#{account.acct}#{@external_links && account.local? ? "@#{Rails.configuration.x.local_domain}" : ''}" end - def avatar_for_status_url(status) - status.reblog? ? status.reblog.account.avatar.url(:original) : status.account.avatar.url(:original) - end - def entry_classes(status, is_predecessor, is_successor, include_threads) classes = ['entry'] classes << 'entry-reblog u-repost-of h-cite' if status.reblog? @@ -22,18 +18,6 @@ module StreamEntriesHelper classes.join(' ') end - def relative_time(date) - date < 5.days.ago ? date.strftime('%d.%m.%Y') : "#{time_ago_in_words(date)} ago" - end - - def reblogged_by_me_class(status) - user_signed_in? && @reblogged.key?(status.id) ? 'reblogged' : '' - end - - def favourited_by_me_class(status) - user_signed_in? && @favourited.key?(status.id) ? 'favourited' : '' - end - def rtl?(text) return false if text.empty? diff --git a/spec/helpers/stream_entries_helper_spec.rb b/spec/helpers/stream_entries_helper_spec.rb index 221e1e32d..a83133917 100644 --- a/spec/helpers/stream_entries_helper_spec.rb +++ b/spec/helpers/stream_entries_helper_spec.rb @@ -15,23 +15,7 @@ RSpec.describe StreamEntriesHelper, type: :helper do end end - describe '#avatar_for_status_url' do - pending - end - describe '#entry_classes' do pending end - - describe '#relative_time' do - pending - end - - describe '#reblogged_by_me_class' do - pending - end - - describe '#favourited_by_me_class' do - pending - end end -- cgit