We changed the default to unlisted, and it broke these.
# frozen_string_literal: true
-require 'rails_helper'
+require "rails_helper"
describe Api::V1::Timelines::PublicController do
render_views
allow(controller).to receive(:doorkeeper_token) { token }
end
- context 'with a user context' do
+ context "with a user context" do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
- describe 'GET #show' do
+ describe "GET #show" do
before do
- PostStatusService.new.call(user.account, text: 'New status from user for federated public timeline.')
+ PostStatusService.new.call(user.account, text: "New status from user for federated public timeline.", visibility: :public)
end
- it 'returns http success' do
+ it "returns http success" do
get :show
expect(response).to have_http_status(200)
- expect(response.headers['Link'].links.size).to eq(2)
+ expect(response.headers["Link"].links.size).to eq(2)
end
end
- describe 'GET #show with local only' do
+ describe "GET #show with local only" do
before do
- PostStatusService.new.call(user.account, text: 'New status from user for local public timeline.')
+ PostStatusService.new.call(user.account, text: "New status from user for local public timeline.", visibility: :public)
end
- it 'returns http success' do
- get :show, params: { local: true }
+ it "returns http success" do
+ get :show, params: {local: true}
expect(response).to have_http_status(200)
- expect(response.headers['Link'].links.size).to eq(2)
+ expect(response.headers["Link"].links.size).to eq(2)
end
end
end
- context 'without a user context' do
+ context "without a user context" do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: nil) }
before do
Setting.timeline_preview = true
end
- describe 'GET #show' do
- it 'returns http success' do
+ describe "GET #show" do
+ it "returns http success" do
get :show
expect(response).to have_http_status(200)
- expect(response.headers['Link']).to be_nil
+ expect(response.headers["Link"]).to be_nil
end
end
end
# frozen_string_literal: true
-require 'rails_helper'
+require "rails_helper"
describe Api::V1::Timelines::TagController do
render_views
allow(controller).to receive(:doorkeeper_token) { token }
end
- context 'with a user context' do
+ context "with a user context" do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
- describe 'GET #show' do
+ describe "GET #show" do
before do
- PostStatusService.new.call(user.account, text: 'It is a #test')
+ PostStatusService.new.call(user.account, text: "It is a #test", visibility: :public)
end
- it 'returns http success' do
- get :show, params: { id: 'test' }
+ it "returns http success" do
+ get :show, params: {id: "test"}
expect(response).to have_http_status(200)
- expect(response.headers['Link'].links.size).to eq(2)
+ expect(response.headers["Link"].links.size).to eq(2)
end
end
end
- context 'without a user context' do
+ context "without a user context" do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: nil) }
- describe 'GET #show' do
- it 'returns http success' do
- get :show, params: { id: 'test' }
+ describe "GET #show" do
+ it "returns http success" do
+ get :show, params: {id: "test"}
expect(response).to have_http_status(200)
- expect(response.headers['Link']).to be_nil
+ expect(response.headers["Link"]).to be_nil
end
end
end
-require 'rails_helper'
+require "rails_helper"
RSpec.describe BatchedRemoveStatusService, type: :service do
subject { BatchedRemoveStatusService.new }
- let!(:alice) { Fabricate(:account) }
- let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') }
- let!(:jeff) { Fabricate(:account) }
- let!(:hank) { Fabricate(:account, username: 'hank', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
+ let!(:alice) { Fabricate(:account) }
+ let!(:bob) { Fabricate(:account, username: "bob", domain: "example.com") }
+ let!(:jeff) { Fabricate(:account) }
+ let!(:hank) { Fabricate(:account, username: "hank", protocol: :activitypub, domain: "example.com", inbox_url: "http://example.com/inbox") }
- let(:status1) { PostStatusService.new.call(alice, text: 'Hello @bob@example.com') }
- let(:status2) { PostStatusService.new.call(alice, text: 'Another status') }
+ let(:status1) { PostStatusService.new.call(alice, text: "Hello @bob@example.com", visibility: :public) }
+ let(:status2) { PostStatusService.new.call(alice, text: "Another status", visibility: :public) }
before do
allow(redis).to receive_messages(publish: nil)
- stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
+ stub_request(:post, "http://example.com/inbox").to_return(status: 200)
jeff.user.update(current_sign_in_at: Time.zone.now)
jeff.follow!(alice)
subject.call([status1, status2])
end
- it 'removes statuses' do
+ it "removes statuses" do
expect { Status.find(status1.id) }.to raise_error ActiveRecord::RecordNotFound
expect { Status.find(status2.id) }.to raise_error ActiveRecord::RecordNotFound
end
- it 'removes statuses from author\'s home feed' do
+ it "removes statuses from author's home feed" do
expect(HomeFeed.new(alice).get(10)).to_not include([status1.id, status2.id])
end
- it 'removes statuses from local follower\'s home feed' do
+ it "removes statuses from local follower's home feed" do
expect(HomeFeed.new(jeff).get(10)).to_not include([status1.id, status2.id])
end
- it 'notifies streaming API of followers' do
+ it "notifies streaming API of followers" do
expect(redis).to have_received(:publish).with("timeline:#{jeff.id}", any_args).at_least(:once)
end
- it 'notifies streaming API of public timeline' do
- expect(redis).to have_received(:publish).with('timeline:public', any_args).at_least(:once)
+ it "notifies streaming API of public timeline" do
+ expect(redis).to have_received(:publish).with("timeline:public", any_args).at_least(:once)
end
- it 'sends delete activity to followers' do
- expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.at_least_once
+ it "sends delete activity to followers" do
+ expect(a_request(:post, "http://example.com/inbox")).to have_been_made.at_least_once
end
end