]> cat aescling's git repositories - mastodon.git/commitdiff
Fix tests which expected public visibility origin/gitlab-ci-2
authorkibigo! <go@kibi.family>
Mon, 9 May 2022 04:52:06 +0000 (21:52 -0700)
committerkibigo! <go@kibi.family>
Tue, 10 May 2022 01:40:23 +0000 (18:40 -0700)
We changed the default to unlisted, and it broke these.

spec/controllers/api/v1/timelines/public_controller_spec.rb
spec/controllers/api/v1/timelines/tag_controller_spec.rb
spec/services/batched_remove_status_service_spec.rb

index 0892d5db64b75204109d6de1826940ac5474ce88..61cb21caa9d5cd0811cd44827a042a99cc756f97 100644 (file)
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'rails_helper'
+require "rails_helper"
 
 describe Api::V1::Timelines::PublicController do
   render_views
@@ -11,49 +11,49 @@ describe Api::V1::Timelines::PublicController do
     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
index 718911083362de7902a6726568837e6aea9fdb51..61b3c870cf03ad516c913ae79fb110694f6b52b9 100644 (file)
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'rails_helper'
+require "rails_helper"
 
 describe Api::V1::Timelines::TagController do
   render_views
@@ -11,30 +11,30 @@ describe Api::V1::Timelines::TagController do
     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
index 920edeb13e5ac5a5ad0a0ca1b4a9c3123ddecbf0..c46e6bee82727957429bc98829c256098862178a 100644 (file)
@@ -1,20 +1,20 @@
-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)
@@ -26,28 +26,28 @@ RSpec.describe BatchedRemoveStatusService, type: :service do
     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