diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-02 18:50:33 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-02 18:50:33 +0100 |
commit | 4c0e9f85c5c9e3be91f9a76139fab3b55abbf363 (patch) | |
tree | 9d60c6b37a6adb60b20a674630587de4e55d8765 /spec/controllers/api/v1/accounts_controller_spec.rb | |
parent | 89fc2d7f4810ecdf66b17543f4603c1089a0c3f5 (diff) | |
parent | c64a1c25c4e9a07c694863a38334ed66e368752e (diff) |
Merge branch 'KitRedgrave-add-mute-button'
Diffstat (limited to 'spec/controllers/api/v1/accounts_controller_spec.rb')
-rw-r--r-- | spec/controllers/api/v1/accounts_controller_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb index 98b284f7a..5d36b0159 100644 --- a/spec/controllers/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts_controller_spec.rb @@ -116,6 +116,44 @@ RSpec.describe Api::V1::AccountsController, type: :controller do end end + describe 'POST #mute' 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 } + 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 + end + + describe 'POST #unmute' do + let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account } + + before do + user.account.mute!(other_account) + post :unmute, params: { id: other_account.id } + end + + it 'returns http success' do + expect(response).to have_http_status(:success) + end + + it 'removes the muting relation between user and target user' do + expect(user.account.muting?(other_account)).to be false + end + end + describe 'GET #relationships' do let(:simon) { Fabricate(:user, email: 'simon@example.com', account: Fabricate(:account, username: 'simon')).account } let(:lewis) { Fabricate(:user, email: 'lewis@example.com', account: Fabricate(:account, username: 'lewis')).account } |