Remove Atom feeds and old URLs in the form of GET /:username/updates/:id
(#11247)
This commit is contained in:
@ -48,37 +48,6 @@ RSpec.describe AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'atom' do
|
||||
let(:format) { 'atom' }
|
||||
let(:content_type) { 'application/atom+xml' }
|
||||
|
||||
shared_examples 'responsed streams' do
|
||||
it 'assigns @entries' do
|
||||
entries = assigns(:entries).to_a
|
||||
expect(entries.size).to eq expected_statuses.size
|
||||
entries.each.zip(expected_statuses.each) do |entry, expected_status|
|
||||
expect(entry.status).to eq expected_status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include_examples 'responses'
|
||||
|
||||
context 'without max_id nor since_id' do
|
||||
let(:expected_statuses) { [status7, status6, status5, status4, status3, status2, status1] }
|
||||
|
||||
include_examples 'responsed streams'
|
||||
end
|
||||
|
||||
context 'with max_id and since_id' do
|
||||
let(:max_id) { status4.stream_entry.id }
|
||||
let(:since_id) { status1.stream_entry.id }
|
||||
let(:expected_statuses) { [status3, status2] }
|
||||
|
||||
include_examples 'responsed streams'
|
||||
end
|
||||
end
|
||||
|
||||
context 'activitystreams2' do
|
||||
let(:format) { 'json' }
|
||||
let(:content_type) { 'application/activity+json' }
|
||||
|
@ -9,7 +9,7 @@ RSpec.describe Api::OEmbedController, type: :controller do
|
||||
describe 'GET #show' do
|
||||
before do
|
||||
request.host = Rails.configuration.x.local_domain
|
||||
get :show, params: { url: account_stream_entry_url(alice, status.stream_entry) }, format: :json
|
||||
get :show, params: { url: short_account_status_url(alice, status) }, format: :json
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -360,9 +360,5 @@ describe ApplicationController, type: :controller do
|
||||
context 'Status' do
|
||||
include_examples 'cacheable', :status, Status
|
||||
end
|
||||
|
||||
context 'StreamEntry' do
|
||||
include_examples 'receives :with_includes', :stream_entry, StreamEntry
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -55,18 +55,6 @@ describe StatusesController do
|
||||
expect(assigns(:status)).to eq status
|
||||
end
|
||||
|
||||
it 'assigns @stream_entry' do
|
||||
status = Fabricate(:status)
|
||||
get :show, params: { account_username: status.account.username, id: status.id }
|
||||
expect(assigns(:stream_entry)).to eq status.stream_entry
|
||||
end
|
||||
|
||||
it 'assigns @type' do
|
||||
status = Fabricate(:status)
|
||||
get :show, params: { account_username: status.account.username, id: status.id }
|
||||
expect(assigns(:type)).to eq 'status'
|
||||
end
|
||||
|
||||
it 'assigns @ancestors for ancestors of the status if it is a reply' do
|
||||
ancestor = Fabricate(:status)
|
||||
status = Fabricate(:status, in_reply_to_id: ancestor.id)
|
||||
@ -135,10 +123,10 @@ describe StatusesController do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'renders stream_entries/show' do
|
||||
it 'renders statuses/show' do
|
||||
status = Fabricate(:status)
|
||||
get :show, params: { account_username: status.account.username, id: status.id }
|
||||
expect(response).to render_template 'stream_entries/show'
|
||||
expect(response).to render_template 'statuses/show'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,95 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StreamEntriesController, type: :controller do
|
||||
render_views
|
||||
|
||||
shared_examples 'before_action' do |route|
|
||||
context 'when account is not suspended and stream_entry is available' do
|
||||
it 'assigns instance variables' do
|
||||
status = Fabricate(:status)
|
||||
|
||||
get route, params: { account_username: status.account.username, id: status.stream_entry.id }
|
||||
|
||||
expect(assigns(:account)).to eq status.account
|
||||
expect(assigns(:stream_entry)).to eq status.stream_entry
|
||||
expect(assigns(:type)).to eq 'status'
|
||||
end
|
||||
|
||||
it 'sets Link headers' do
|
||||
alice = Fabricate(:account, username: 'alice')
|
||||
status = Fabricate(:status, account: alice)
|
||||
|
||||
get route, params: { account_username: alice.username, id: status.stream_entry.id }
|
||||
|
||||
expect(response.headers['Link'].to_s).to eq "<http://test.host/users/alice/updates/#{status.stream_entry.id}.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://cb6e6126.ngrok.io/users/alice/statuses/#{status.id}>; rel=\"alternate\"; type=\"application/activity+json\""
|
||||
end
|
||||
end
|
||||
|
||||
context 'when account is suspended' do
|
||||
it 'returns http status 410' do
|
||||
account = Fabricate(:account, suspended: true)
|
||||
status = Fabricate(:status, account: account)
|
||||
|
||||
get route, params: { account_username: account.username, id: status.stream_entry.id }
|
||||
|
||||
expect(response).to have_http_status(410)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when activity is nil' do
|
||||
it 'raises ActiveRecord::RecordNotFound' do
|
||||
account = Fabricate(:account)
|
||||
stream_entry = Fabricate.build(:stream_entry, account: account, activity: nil, activity_type: 'Status')
|
||||
stream_entry.save!(validate: false)
|
||||
|
||||
get route, params: { account_username: account.username, id: stream_entry.id }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it is hidden and it is not permitted' do
|
||||
it 'raises ActiveRecord::RecordNotFound' do
|
||||
status = Fabricate(:status)
|
||||
user = Fabricate(:user)
|
||||
status.account.block!(user.account)
|
||||
status.stream_entry.update!(hidden: true)
|
||||
|
||||
sign_in(user)
|
||||
get route, params: { account_username: status.account.username, id: status.stream_entry.id }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
include_examples 'before_action', :show
|
||||
|
||||
it 'redirects to status page' do
|
||||
status = Fabricate(:status)
|
||||
|
||||
get :show, params: { account_username: status.account.username, id: status.stream_entry.id }
|
||||
|
||||
expect(response).to redirect_to(short_account_status_url(status.account, status))
|
||||
end
|
||||
|
||||
it 'returns http success with Atom' do
|
||||
status = Fabricate(:status)
|
||||
get :show, params: { account_username: status.account.username, id: status.stream_entry.id }, format: 'atom'
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #embed' do
|
||||
include_examples 'before_action', :embed
|
||||
|
||||
it 'redirects to new embed page' do
|
||||
status = Fabricate(:status)
|
||||
|
||||
get :embed, params: { account_username: status.account.username, id: status.stream_entry.id }
|
||||
|
||||
expect(response).to redirect_to(embed_short_account_status_url(status.account, status))
|
||||
end
|
||||
end
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
Fabricator(:stream_entry) do
|
||||
account
|
||||
activity { Fabricate(:status) }
|
||||
hidden { [true, false].sample }
|
||||
end
|
@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::AccountModerationNotesHelper, type: :helper do
|
||||
include StreamEntriesHelper
|
||||
include StatusesHelper
|
||||
|
||||
describe '#admin_account_link_to' do
|
||||
context 'account is nil' do
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StreamEntriesHelper, type: :helper do
|
||||
RSpec.describe StatusesHelper, type: :helper do
|
||||
describe '#display_name' do
|
||||
it 'uses the display name when it exists' do
|
||||
account = Account.new(display_name: "Display", username: "Username")
|
||||
@ -70,13 +70,13 @@ RSpec.describe StreamEntriesHelper, type: :helper do
|
||||
end
|
||||
|
||||
def set_not_embedded_view
|
||||
params[:controller] = "not_#{StreamEntriesHelper::EMBEDDED_CONTROLLER}"
|
||||
params[:action] = "not_#{StreamEntriesHelper::EMBEDDED_ACTION}"
|
||||
params[:controller] = "not_#{StatusesHelper::EMBEDDED_CONTROLLER}"
|
||||
params[:action] = "not_#{StatusesHelper::EMBEDDED_ACTION}"
|
||||
end
|
||||
|
||||
def set_embedded_view
|
||||
params[:controller] = StreamEntriesHelper::EMBEDDED_CONTROLLER
|
||||
params[:action] = StreamEntriesHelper::EMBEDDED_ACTION
|
||||
params[:controller] = StatusesHelper::EMBEDDED_CONTROLLER
|
||||
params[:action] = StatusesHelper::EMBEDDED_ACTION
|
||||
end
|
||||
|
||||
describe '#style_classes' do
|
@ -143,12 +143,6 @@ RSpec.describe ActivityPub::TagManager do
|
||||
expect(subject.uri_to_resource(OStatus::TagManager.instance.uri_for(status), Status)).to eq status
|
||||
end
|
||||
|
||||
it 'returns the local status for OStatus StreamEntry URL' do
|
||||
status = Fabricate(:status)
|
||||
stream_entry_url = account_stream_entry_url(status.account, status.stream_entry)
|
||||
expect(subject.uri_to_resource(stream_entry_url, Status)).to eq status
|
||||
end
|
||||
|
||||
it 'returns the remote status by matching URI without fragment part' do
|
||||
status = Fabricate(:status, uri: 'https://example.com/123')
|
||||
expect(subject.uri_to_resource('https://example.com/123#456', Status)).to eq status
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,15 +25,6 @@ describe StatusFinder do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a stream entry url' do
|
||||
let(:stream_entry) { Fabricate(:stream_entry) }
|
||||
let(:url) { account_stream_entry_url(stream_entry.account, stream_entry) }
|
||||
|
||||
it 'finds the stream entry' do
|
||||
expect(subject.status).to eq(stream_entry.status)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a remote url even if id exists on local' do
|
||||
let(:status) { Fabricate(:status) }
|
||||
let(:url) { "https://example.com/users/test/statuses/#{status.id}" }
|
||||
|
@ -119,46 +119,4 @@ RSpec.describe TagManager do
|
||||
expect(TagManager.instance.same_acct?('username', 'incorrect@Cb6E6126.nGrOk.Io')).to eq false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#url_for' do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { TagManager.instance.url_for(target) }
|
||||
|
||||
context 'activity object' do
|
||||
let(:target) { Fabricate(:status, account: alice, reblog: Fabricate(:status)).stream_entry }
|
||||
|
||||
it 'returns the unique tag for status' do
|
||||
expect(target.object_type).to eq :activity
|
||||
is_expected.to eq "https://cb6e6126.ngrok.io/@alice/#{target.id}"
|
||||
end
|
||||
end
|
||||
|
||||
context 'comment object' do
|
||||
let(:target) { Fabricate(:status, account: alice, reply: true) }
|
||||
|
||||
it 'returns the unique tag for status' do
|
||||
expect(target.object_type).to eq :comment
|
||||
is_expected.to eq "https://cb6e6126.ngrok.io/@alice/#{target.id}"
|
||||
end
|
||||
end
|
||||
|
||||
context 'note object' do
|
||||
let(:target) { Fabricate(:status, account: alice, reply: false, thread: nil) }
|
||||
|
||||
it 'returns the unique tag for status' do
|
||||
expect(target.object_type).to eq :note
|
||||
is_expected.to eq "https://cb6e6126.ngrok.io/@alice/#{target.id}"
|
||||
end
|
||||
end
|
||||
|
||||
context 'person object' do
|
||||
let(:target) { alice }
|
||||
|
||||
it 'returns the URL for account' do
|
||||
expect(target.object_type).to eq :person
|
||||
is_expected.to eq 'https://cb6e6126.ngrok.io/@alice'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,63 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Streamable do
|
||||
class Parent
|
||||
def title; end
|
||||
|
||||
def target; end
|
||||
|
||||
def thread; end
|
||||
|
||||
def self.has_one(*); end
|
||||
|
||||
def self.after_create; end
|
||||
end
|
||||
|
||||
class Child < Parent
|
||||
include Streamable
|
||||
end
|
||||
|
||||
child = Child.new
|
||||
|
||||
describe '#title' do
|
||||
it 'calls Parent#title' do
|
||||
expect_any_instance_of(Parent).to receive(:title)
|
||||
child.title
|
||||
end
|
||||
end
|
||||
|
||||
describe '#content' do
|
||||
it 'calls #title' do
|
||||
expect_any_instance_of(Parent).to receive(:title)
|
||||
child.content
|
||||
end
|
||||
end
|
||||
|
||||
describe '#target' do
|
||||
it 'calls Parent#target' do
|
||||
expect_any_instance_of(Parent).to receive(:target)
|
||||
child.target
|
||||
end
|
||||
end
|
||||
|
||||
describe '#object_type' do
|
||||
it 'returns :activity' do
|
||||
expect(child.object_type).to eq :activity
|
||||
end
|
||||
end
|
||||
|
||||
describe '#thread' do
|
||||
it 'calls Parent#thread' do
|
||||
expect_any_instance_of(Parent).to receive(:thread)
|
||||
child.thread
|
||||
end
|
||||
end
|
||||
|
||||
describe '#hidden?' do
|
||||
it 'returns false' do
|
||||
expect(child.hidden?).to be false
|
||||
end
|
||||
end
|
||||
end
|
@ -1,143 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RemoteProfile do
|
||||
let(:remote_profile) { RemoteProfile.new(body) }
|
||||
let(:body) do
|
||||
<<-XML
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<author>John</author>
|
||||
XML
|
||||
end
|
||||
|
||||
describe '.initialize' do
|
||||
it 'calls Nokogiri::XML.parse' do
|
||||
expect(Nokogiri::XML).to receive(:parse).with(body, nil, 'utf-8')
|
||||
RemoteProfile.new(body)
|
||||
end
|
||||
|
||||
it 'sets document' do
|
||||
remote_profile = RemoteProfile.new(body)
|
||||
expect(remote_profile).not_to be nil
|
||||
end
|
||||
end
|
||||
|
||||
describe '#root' do
|
||||
let(:document) { remote_profile.document }
|
||||
|
||||
it 'callse document.at_xpath' do
|
||||
expect(document).to receive(:at_xpath).with(
|
||||
'/atom:feed|/atom:entry',
|
||||
atom: OStatus::TagManager::XMLNS
|
||||
)
|
||||
|
||||
remote_profile.root
|
||||
end
|
||||
end
|
||||
|
||||
describe '#author' do
|
||||
let(:root) { remote_profile.root }
|
||||
|
||||
it 'calls root.at_xpath' do
|
||||
expect(root).to receive(:at_xpath).with(
|
||||
'./atom:author|./dfrn:owner',
|
||||
atom: OStatus::TagManager::XMLNS,
|
||||
dfrn: OStatus::TagManager::DFRN_XMLNS
|
||||
)
|
||||
|
||||
remote_profile.author
|
||||
end
|
||||
end
|
||||
|
||||
describe '#hub_link' do
|
||||
let(:root) { remote_profile.root }
|
||||
|
||||
it 'calls #link_href_from_xml' do
|
||||
expect(remote_profile).to receive(:link_href_from_xml).with(root, 'hub')
|
||||
remote_profile.hub_link
|
||||
end
|
||||
end
|
||||
|
||||
describe '#display_name' do
|
||||
let(:author) { remote_profile.author }
|
||||
|
||||
it 'calls author.at_xpath.content' do
|
||||
expect(author).to receive_message_chain(:at_xpath, :content).with(
|
||||
'./poco:displayName',
|
||||
poco: OStatus::TagManager::POCO_XMLNS
|
||||
).with(no_args)
|
||||
|
||||
remote_profile.display_name
|
||||
end
|
||||
end
|
||||
|
||||
describe '#note' do
|
||||
let(:author) { remote_profile.author }
|
||||
|
||||
it 'calls author.at_xpath.content' do
|
||||
expect(author).to receive_message_chain(:at_xpath, :content).with(
|
||||
'./atom:summary|./poco:note',
|
||||
atom: OStatus::TagManager::XMLNS,
|
||||
poco: OStatus::TagManager::POCO_XMLNS
|
||||
).with(no_args)
|
||||
|
||||
remote_profile.note
|
||||
end
|
||||
end
|
||||
|
||||
describe '#scope' do
|
||||
let(:author) { remote_profile.author }
|
||||
|
||||
it 'calls author.at_xpath.content' do
|
||||
expect(author).to receive_message_chain(:at_xpath, :content).with(
|
||||
'./mastodon:scope',
|
||||
mastodon: OStatus::TagManager::MTDN_XMLNS
|
||||
).with(no_args)
|
||||
|
||||
remote_profile.scope
|
||||
end
|
||||
end
|
||||
|
||||
describe '#avatar' do
|
||||
let(:author) { remote_profile.author }
|
||||
|
||||
it 'calls #link_href_from_xml' do
|
||||
expect(remote_profile).to receive(:link_href_from_xml).with(author, 'avatar')
|
||||
remote_profile.avatar
|
||||
end
|
||||
end
|
||||
|
||||
describe '#header' do
|
||||
let(:author) { remote_profile.author }
|
||||
|
||||
it 'calls #link_href_from_xml' do
|
||||
expect(remote_profile).to receive(:link_href_from_xml).with(author, 'header')
|
||||
remote_profile.header
|
||||
end
|
||||
end
|
||||
|
||||
describe '#locked?' do
|
||||
before do
|
||||
allow(remote_profile).to receive(:scope).and_return(scope)
|
||||
end
|
||||
|
||||
subject { remote_profile.locked? }
|
||||
|
||||
context 'scope is private' do
|
||||
let(:scope) { 'private' }
|
||||
|
||||
it 'returns true' do
|
||||
is_expected.to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'scope is not private' do
|
||||
let(:scope) { 'public' }
|
||||
|
||||
it 'returns false' do
|
||||
is_expected.to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,192 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StreamEntry, type: :model do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
let(:status) { Fabricate(:status, account: alice) }
|
||||
let(:reblog) { Fabricate(:status, account: bob, reblog: status) }
|
||||
let(:reply) { Fabricate(:status, account: bob, thread: status) }
|
||||
let(:stream_entry) { Fabricate(:stream_entry, activity: activity) }
|
||||
let(:activity) { reblog }
|
||||
|
||||
describe '#object_type' do
|
||||
before do
|
||||
allow(stream_entry).to receive(:orphaned?).and_return(orphaned)
|
||||
allow(stream_entry).to receive(:targeted?).and_return(targeted)
|
||||
end
|
||||
|
||||
subject { stream_entry.object_type }
|
||||
|
||||
context 'orphaned? is true' do
|
||||
let(:orphaned) { true }
|
||||
let(:targeted) { false }
|
||||
|
||||
it 'returns :activity' do
|
||||
is_expected.to be :activity
|
||||
end
|
||||
end
|
||||
|
||||
context 'targeted? is true' do
|
||||
let(:orphaned) { false }
|
||||
let(:targeted) { true }
|
||||
|
||||
it 'returns :activity' do
|
||||
is_expected.to be :activity
|
||||
end
|
||||
end
|
||||
|
||||
context 'orphaned? and targeted? are false' do
|
||||
let(:orphaned) { false }
|
||||
let(:targeted) { false }
|
||||
|
||||
context 'activity is reblog' do
|
||||
let(:activity) { reblog }
|
||||
|
||||
it 'returns :note' do
|
||||
is_expected.to be :note
|
||||
end
|
||||
end
|
||||
|
||||
context 'activity is reply' do
|
||||
let(:activity) { reply }
|
||||
|
||||
it 'returns :comment' do
|
||||
is_expected.to be :comment
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#verb' do
|
||||
before do
|
||||
allow(stream_entry).to receive(:orphaned?).and_return(orphaned)
|
||||
end
|
||||
|
||||
subject { stream_entry.verb }
|
||||
|
||||
context 'orphaned? is true' do
|
||||
let(:orphaned) { true }
|
||||
|
||||
it 'returns :delete' do
|
||||
is_expected.to be :delete
|
||||
end
|
||||
end
|
||||
|
||||
context 'orphaned? is false' do
|
||||
let(:orphaned) { false }
|
||||
|
||||
context 'activity is reblog' do
|
||||
let(:activity) { reblog }
|
||||
|
||||
it 'returns :share' do
|
||||
is_expected.to be :share
|
||||
end
|
||||
end
|
||||
|
||||
context 'activity is reply' do
|
||||
let(:activity) { reply }
|
||||
|
||||
it 'returns :post' do
|
||||
is_expected.to be :post
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#mentions' do
|
||||
before do
|
||||
allow(stream_entry).to receive(:orphaned?).and_return(orphaned)
|
||||
end
|
||||
|
||||
subject { stream_entry.mentions }
|
||||
|
||||
context 'orphaned? is true' do
|
||||
let(:orphaned) { true }
|
||||
|
||||
it 'returns []' do
|
||||
is_expected.to eq []
|
||||
end
|
||||
end
|
||||
|
||||
context 'orphaned? is false' do
|
||||
before do
|
||||
reblog.mentions << Fabricate(:mention, account: alice)
|
||||
reblog.mentions << Fabricate(:mention, account: bob)
|
||||
end
|
||||
|
||||
let(:orphaned) { false }
|
||||
|
||||
it 'returns [Account] includes alice and bob' do
|
||||
is_expected.to eq [alice, bob]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#targeted?' do
|
||||
it 'returns true for a reblog' do
|
||||
expect(reblog.stream_entry.targeted?).to be true
|
||||
end
|
||||
|
||||
it 'returns false otherwise' do
|
||||
expect(status.stream_entry.targeted?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#threaded?' do
|
||||
it 'returns true for a reply' do
|
||||
expect(reply.stream_entry.threaded?).to be true
|
||||
end
|
||||
|
||||
it 'returns false otherwise' do
|
||||
expect(status.stream_entry.threaded?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe 'delegated methods' do
|
||||
context 'with a nil status' do
|
||||
subject { described_class.new(status: nil) }
|
||||
|
||||
it 'returns nil for target' do
|
||||
expect(subject.target).to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil for title' do
|
||||
expect(subject.title).to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil for content' do
|
||||
expect(subject.content).to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil for thread' do
|
||||
expect(subject.thread).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a real status' do
|
||||
let(:original) { Fabricate(:status, text: 'Test status') }
|
||||
let(:status) { Fabricate(:status, reblog: original, thread: original) }
|
||||
subject { described_class.new(status: status) }
|
||||
|
||||
it 'delegates target' do
|
||||
expect(status.target).not_to be_nil
|
||||
expect(subject.target).to eq(status.target)
|
||||
end
|
||||
|
||||
it 'delegates title' do
|
||||
expect(status.title).not_to be_nil
|
||||
expect(subject.title).to eq(status.title)
|
||||
end
|
||||
|
||||
it 'delegates content' do
|
||||
expect(status.content).not_to be_nil
|
||||
expect(subject.content).to eq(status.content)
|
||||
end
|
||||
|
||||
it 'delegates thread' do
|
||||
expect(status.thread).not_to be_nil
|
||||
expect(subject.thread).to eq(status.thread)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -15,8 +15,8 @@ RSpec.describe ProcessMentionsService, type: :service do
|
||||
subject.call(status)
|
||||
end
|
||||
|
||||
it 'creates a mention' do
|
||||
expect(remote_user.mentions.where(status: status).count).to eq 1
|
||||
it 'does not create a mention' do
|
||||
expect(remote_user.mentions.where(status: status).count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,14 +27,13 @@ RSpec.describe SuspendAccountService, type: :service do
|
||||
[
|
||||
account.statuses,
|
||||
account.media_attachments,
|
||||
account.stream_entries,
|
||||
account.notifications,
|
||||
account.favourites,
|
||||
account.active_relationships,
|
||||
account.passive_relationships,
|
||||
account.subscriptions
|
||||
].map(&:count)
|
||||
}.from([1, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
|
||||
}.from([1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'sends a delete actor activity to all known inboxes' do
|
||||
@ -70,14 +69,13 @@ RSpec.describe SuspendAccountService, type: :service do
|
||||
[
|
||||
remote_bob.statuses,
|
||||
remote_bob.media_attachments,
|
||||
remote_bob.stream_entries,
|
||||
remote_bob.notifications,
|
||||
remote_bob.favourites,
|
||||
remote_bob.active_relationships,
|
||||
remote_bob.passive_relationships,
|
||||
remote_bob.subscriptions
|
||||
].map(&:count)
|
||||
}.from([1, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
|
||||
}.from([1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'sends a reject follow to follwer inboxes' do
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true do
|
||||
describe 'statuses/show.html.haml', without_verify_partial_doubles: true do
|
||||
before do
|
||||
double(:api_oembed_url => '')
|
||||
double(:account_stream_entry_url => '')
|
||||
allow(view).to receive(:show_landing_strip?).and_return(true)
|
||||
allow(view).to receive(:site_title).and_return('example site')
|
||||
allow(view).to receive(:site_hostname).and_return('example.com')
|
||||
@ -23,9 +22,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d
|
||||
reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice')
|
||||
|
||||
assign(:status, status)
|
||||
assign(:stream_entry, status.stream_entry)
|
||||
assign(:account, alice)
|
||||
assign(:type, status.stream_entry.activity_type.downcase)
|
||||
assign(:descendant_threads, [])
|
||||
|
||||
render
|
||||
@ -46,11 +43,9 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d
|
||||
comment = Fabricate(:status, account: carl, thread: reply, text: 'Hello Bob')
|
||||
|
||||
assign(:status, reply)
|
||||
assign(:stream_entry, reply.stream_entry)
|
||||
assign(:account, alice)
|
||||
assign(:type, reply.stream_entry.activity_type.downcase)
|
||||
assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob))
|
||||
assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }])
|
||||
assign(:ancestors, reply.ancestors(1, bob))
|
||||
assign(:descendant_threads, [{ statuses: reply.descendants(1) }])
|
||||
|
||||
render
|
||||
|
||||
@ -71,9 +66,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d
|
||||
status = Fabricate(:status, account: alice, text: 'Hello World')
|
||||
|
||||
assign(:status, status)
|
||||
assign(:stream_entry, status.stream_entry)
|
||||
assign(:account, alice)
|
||||
assign(:type, status.stream_entry.activity_type.downcase)
|
||||
assign(:descendant_threads, [])
|
||||
|
||||
render
|
Reference in New Issue
Block a user