about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-01-13 13:39:46 -0600
committerStarfall <us@starfall.systems>2021-01-13 13:39:46 -0600
commit65263e6309fb4dea1a93d4b4806af629d317c156 (patch)
tree8a142dea5cc3d4081f551c02e953976d3c0930bf /spec/controllers
parent29227b32e150894e15098bcf216b1f5c08763200 (diff)
parenta7a47834e50645746355e2b9a88244c1804c73cd (diff)
Merge branch 'glitch' into main
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/api/v1/accounts_controller_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb
index 1e656503f..d9ee37ffa 100644
--- a/spec/controllers/api/v1/accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts_controller_spec.rb
@@ -268,6 +268,34 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
     it_behaves_like 'forbidden for wrong scope', 'read:accounts'
   end
 
+  describe 'POST #mute with nonzero duration set' do
+    let(:scopes) { 'write:mutes' }
+    let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
+
+    before do
+      user.account.follow!(other_account)
+      post :mute, params: { id: other_account.id, duration: 300 }
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(200)
+    end
+
+    it 'does not remove the following relation between user and target user' do
+      expect(user.account.following?(other_account)).to be true
+    end
+
+    it 'creates a muting relation' do
+      expect(user.account.muting?(other_account)).to be true
+    end
+
+    it 'mutes notifications' do
+      expect(user.account.muting_notifications?(other_account)).to be true
+    end
+
+    it_behaves_like 'forbidden for wrong scope', 'read:accounts'
+  end
+
   describe 'POST #unmute' do
     let(:scopes) { 'write:mutes' }
     let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }