about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2017-07-27 23:31:39 -0500
committerSurinna Curtis <ekiru.0@gmail.com>2017-09-13 21:47:30 -0500
commiteaaf2170fe76def60f056df99decc1cf0898cd6f (patch)
treede6d23a77860993d92ec0ea859b490c613ba9dea /spec
parent6f7d00bfddb03ead2e5b4011cbe21c4e97b92421 (diff)
API support for muting notifications (and specs)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/v1/accounts_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb
index 05df2f844..96e8ecd43 100644
--- a/spec/controllers/api/v1/accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts_controller_spec.rb
@@ -114,6 +114,35 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
     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
+  end
+
+  describe 'POST #mute with notifications set to false' do
+    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, notifications: false }
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(:success)
+    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 'does not mute notifications' do
+      expect(user.account.muting_notifications?(other_account)).to be false
+    end
   end
 
   describe 'POST #unmute' do