From b071e618e7c53a89ee332ae4c7afe9c5b4e9d176 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 19 Sep 2024 06:15:21 -0400 Subject: [PATCH] Combine API request spec assertions (#31970) --- spec/requests/api/v1/admin/accounts_spec.rb | 6 +-- spec/requests/api/v1/admin/tags_spec.rb | 12 +----- spec/requests/api/v1/apps/credentials_spec.rb | 12 +----- spec/requests/api/v1/blocks_spec.rb | 7 +--- spec/requests/api/v1/bookmarks_spec.rb | 7 +--- spec/requests/api/v1/favourites_spec.rb | 14 +------ spec/requests/api/v1/featured_tags_spec.rb | 19 +--------- spec/requests/api/v1/followed_tags_spec.rb | 7 +--- .../api/v1/instances/languages_spec.rb | 5 +-- spec/requests/api/v1/lists/accounts_spec.rb | 7 +--- spec/requests/api/v1/media_spec.rb | 7 +--- spec/requests/api/v1/mutes_spec.rb | 14 +------ .../api/v1/notifications/requests_spec.rb | 7 +--- spec/requests/api/v1/profiles_spec.rb | 38 +------------------ .../api/v1/statuses/bookmarks_spec.rb | 18 ++------- .../api/v1/statuses/favourites_spec.rb | 18 ++------- spec/requests/api/v1/statuses/pins_spec.rb | 12 +----- spec/requests/api/v1/suggestions_spec.rb | 14 +------ spec/requests/api/v1/timelines/home_spec.rb | 12 +----- spec/requests/api/v1/timelines/link_spec.rb | 6 +-- spec/requests/api/v2/filters_spec.rb | 26 ++----------- 21 files changed, 36 insertions(+), 232 deletions(-) diff --git a/spec/requests/api/v1/admin/accounts_spec.rb b/spec/requests/api/v1/admin/accounts_spec.rb index 2dc45d5eb2..f557b61403 100644 --- a/spec/requests/api/v1/admin/accounts_spec.rb +++ b/spec/requests/api/v1/admin/accounts_spec.rb @@ -193,15 +193,11 @@ RSpec.describe 'Accounts' do it_behaves_like 'forbidden for wrong scope', 'write write:accounts read admin:read' it_behaves_like 'forbidden for wrong role', '' - it 'removes the user successfully', :aggregate_failures do + it 'removes the user successfully and logs action', :aggregate_failures do subject expect(response).to have_http_status(200) expect(User.where(id: account.user.id)).to_not exist - end - - it 'logs action', :aggregate_failures do - subject expect(latest_admin_action_log) .to be_present diff --git a/spec/requests/api/v1/admin/tags_spec.rb b/spec/requests/api/v1/admin/tags_spec.rb index 2f730cdeb8..fda9227acf 100644 --- a/spec/requests/api/v1/admin/tags_spec.rb +++ b/spec/requests/api/v1/admin/tags_spec.rb @@ -73,14 +73,10 @@ RSpec.describe 'Tags' do it_behaves_like 'forbidden for wrong scope', 'write:statuses' it_behaves_like 'forbidden for wrong role', '' - it 'returns http success' do + it 'returns http success and expected tag content' do subject expect(response).to have_http_status(200) - end - - it 'returns expected tag content' do - subject expect(response.parsed_body[:id].to_i).to eq(tag.id) expect(response.parsed_body[:name]).to eq(tag.name) @@ -107,14 +103,10 @@ RSpec.describe 'Tags' do it_behaves_like 'forbidden for wrong scope', 'admin:read' it_behaves_like 'forbidden for wrong role', '' - it 'returns http success' do + it 'returns http success and updates tag' do subject expect(response).to have_http_status(200) - end - - it 'returns updated tag' do - subject expect(response.parsed_body[:id].to_i).to eq(tag.id) expect(response.parsed_body[:name]).to eq(tag.name.upcase) diff --git a/spec/requests/api/v1/apps/credentials_spec.rb b/spec/requests/api/v1/apps/credentials_spec.rb index 1cd6a4178f..6fd885eb86 100644 --- a/spec/requests/api/v1/apps/credentials_spec.rb +++ b/spec/requests/api/v1/apps/credentials_spec.rb @@ -47,14 +47,10 @@ RSpec.describe 'Credentials' do let(:token) { Fabricate(:accessible_access_token, application: application) } let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } - it 'returns http success' do + it 'returns http success and returns app information' do subject expect(response).to have_http_status(200) - end - - it 'returns the app information correctly' do - subject expect(response.parsed_body).to match( a_hash_including( @@ -108,14 +104,10 @@ RSpec.describe 'Credentials' do let(:token) { Fabricate(:accessible_access_token, application: application) } let(:headers) { { 'Authorization' => "Bearer #{token.token}-invalid" } } - it 'returns http authorization error' do + it 'returns http authorization error with json error' do subject expect(response).to have_http_status(401) - end - - it 'returns the error in the json response' do - subject expect(response.parsed_body).to match( a_hash_including( diff --git a/spec/requests/api/v1/blocks_spec.rb b/spec/requests/api/v1/blocks_spec.rb index d2f1c46a5b..fc028f9bac 100644 --- a/spec/requests/api/v1/blocks_spec.rb +++ b/spec/requests/api/v1/blocks_spec.rb @@ -32,15 +32,10 @@ RSpec.describe 'Blocks' do context 'with limit param' do let(:params) { { limit: 2 } } - it 'returns only the requested number of blocked accounts' do + it 'returns only the requested number of blocked accounts and sets link header pagination' do subject expect(response.parsed_body.size).to eq(params[:limit]) - end - - it 'sets correct link header pagination' do - subject - expect(response) .to include_pagination_headers( prev: api_v1_blocks_url(limit: params[:limit], since_id: blocks.last.id), diff --git a/spec/requests/api/v1/bookmarks_spec.rb b/spec/requests/api/v1/bookmarks_spec.rb index 95a71abcac..5955de6652 100644 --- a/spec/requests/api/v1/bookmarks_spec.rb +++ b/spec/requests/api/v1/bookmarks_spec.rb @@ -24,15 +24,10 @@ RSpec.describe 'Bookmarks' do it_behaves_like 'forbidden for wrong scope', 'write' - it 'returns http success' do + it 'returns http success and the bookmarked statuses' do subject expect(response).to have_http_status(200) - end - - it 'returns the bookmarked statuses' do - subject - expect(response.parsed_body).to match_array(expected_response) end diff --git a/spec/requests/api/v1/favourites_spec.rb b/spec/requests/api/v1/favourites_spec.rb index 78e9d61551..2f8bef1190 100644 --- a/spec/requests/api/v1/favourites_spec.rb +++ b/spec/requests/api/v1/favourites_spec.rb @@ -24,30 +24,20 @@ RSpec.describe 'Favourites' do it_behaves_like 'forbidden for wrong scope', 'write' - it 'returns http success' do + it 'returns http success and includes the favourites' do subject expect(response).to have_http_status(200) - end - - it 'returns the favourites' do - subject - expect(response.parsed_body).to match_array(expected_response) end context 'with limit param' do let(:params) { { limit: 1 } } - it 'returns only the requested number of favourites' do + it 'returns only the requested number of favourites and sets pagination headers' do subject expect(response.parsed_body.size).to eq(params[:limit]) - end - - it 'sets the correct pagination headers' do - subject - expect(response) .to include_pagination_headers( prev: api_v1_favourites_url(limit: params[:limit], min_id: favourites.last.id), diff --git a/spec/requests/api/v1/featured_tags_spec.rb b/spec/requests/api/v1/featured_tags_spec.rb index 423cc0c560..f0e939d42a 100644 --- a/spec/requests/api/v1/featured_tags_spec.rb +++ b/spec/requests/api/v1/featured_tags_spec.rb @@ -58,15 +58,10 @@ RSpec.describe 'FeaturedTags' do describe 'POST /api/v1/featured_tags' do let(:params) { { name: 'tag' } } - it 'returns http success' do + it 'returns http success and includes correct tag name' do post '/api/v1/featured_tags', headers: headers, params: params expect(response).to have_http_status(200) - end - - it 'returns the correct tag name' do - post '/api/v1/featured_tags', headers: headers, params: params - expect(response.parsed_body) .to include( name: params[:name] @@ -132,23 +127,13 @@ RSpec.describe 'FeaturedTags' do let!(:featured_tag) { FeaturedTag.create(name: 'tag', account: user.account) } let(:id) { featured_tag.id } - it 'returns http success' do + it 'returns http success with an empty body and deletes the featured tag', :inline_jobs do delete "/api/v1/featured_tags/#{id}", headers: headers expect(response).to have_http_status(200) - end - - it 'returns an empty body' do - delete "/api/v1/featured_tags/#{id}", headers: headers - expect(response.parsed_body).to be_empty - end - - it 'deletes the featured tag', :inline_jobs do - delete "/api/v1/featured_tags/#{id}", headers: headers featured_tag = FeaturedTag.find_by(id: id) - expect(featured_tag).to be_nil end diff --git a/spec/requests/api/v1/followed_tags_spec.rb b/spec/requests/api/v1/followed_tags_spec.rb index f7787cb763..f15c0d7f44 100644 --- a/spec/requests/api/v1/followed_tags_spec.rb +++ b/spec/requests/api/v1/followed_tags_spec.rb @@ -28,15 +28,10 @@ RSpec.describe 'Followed tags' do it_behaves_like 'forbidden for wrong scope', 'write write:follows' - it 'returns http success' do + it 'returns http success and includes followed tags' do subject expect(response).to have_http_status(:success) - end - - it 'returns the followed tags correctly' do - subject - expect(response.parsed_body).to match_array(expected_response) end diff --git a/spec/requests/api/v1/instances/languages_spec.rb b/spec/requests/api/v1/instances/languages_spec.rb index 79ea62c599..3ab1ba57b8 100644 --- a/spec/requests/api/v1/instances/languages_spec.rb +++ b/spec/requests/api/v1/instances/languages_spec.rb @@ -8,11 +8,8 @@ RSpec.describe 'Languages' do get '/api/v1/instance/languages' end - it 'returns http success' do + it 'returns http success and includes supported languages' do expect(response).to have_http_status(200) - end - - it 'returns the supported languages' do expect(response.parsed_body.pluck(:code)).to match_array LanguagesHelper::SUPPORTED_LOCALES.keys.map(&:to_s) end end diff --git a/spec/requests/api/v1/lists/accounts_spec.rb b/spec/requests/api/v1/lists/accounts_spec.rb index d147b21ee7..6e5f9e4e9d 100644 --- a/spec/requests/api/v1/lists/accounts_spec.rb +++ b/spec/requests/api/v1/lists/accounts_spec.rb @@ -139,16 +139,11 @@ RSpec.describe 'Accounts' do list.accounts << [bob, peter] end - it 'removes the specified account from the list', :aggregate_failures do + it 'removes the specified account from the list but keeps other accounts in the list', :aggregate_failures do subject expect(response).to have_http_status(200) expect(list.accounts).to_not include(bob) - end - - it 'does not remove any other account from the list' do - subject - expect(list.accounts).to include(peter) end diff --git a/spec/requests/api/v1/media_spec.rb b/spec/requests/api/v1/media_spec.rb index d0af334825..a10bbb31ef 100644 --- a/spec/requests/api/v1/media_spec.rb +++ b/spec/requests/api/v1/media_spec.rb @@ -17,15 +17,10 @@ RSpec.describe 'Media' do it_behaves_like 'forbidden for wrong scope', 'read' - it 'returns http success' do + it 'returns http success with media information' do subject expect(response).to have_http_status(200) - end - - it 'returns the media information' do - subject - expect(response.parsed_body).to match( a_hash_including( id: media.id.to_s, diff --git a/spec/requests/api/v1/mutes_spec.rb b/spec/requests/api/v1/mutes_spec.rb index 6402c908ff..316d455d28 100644 --- a/spec/requests/api/v1/mutes_spec.rb +++ b/spec/requests/api/v1/mutes_spec.rb @@ -18,32 +18,22 @@ RSpec.describe 'Mutes' do it_behaves_like 'forbidden for wrong scope', 'write write:mutes' - it 'returns http success' do + it 'returns http success with muted accounts' do subject expect(response).to have_http_status(200) - end - - it 'returns the muted accounts' do - subject muted_accounts = mutes.map(&:target_account) - expect(response.parsed_body.pluck(:id)).to match_array(muted_accounts.map { |account| account.id.to_s }) end context 'with limit param' do let(:params) { { limit: 1 } } - it 'returns only the requested number of muted accounts' do + it 'returns only the requested number of muted accounts with pagination headers' do subject expect(response.parsed_body.size).to eq(params[:limit]) - end - - it 'sets the correct pagination headers', :aggregate_failures do - subject - expect(response) .to include_pagination_headers( prev: api_v1_mutes_url(limit: params[:limit], since_id: mutes.last.id), diff --git a/spec/requests/api/v1/notifications/requests_spec.rb b/spec/requests/api/v1/notifications/requests_spec.rb index dc125bc7aa..030b7cfa21 100644 --- a/spec/requests/api/v1/notifications/requests_spec.rb +++ b/spec/requests/api/v1/notifications/requests_spec.rb @@ -39,15 +39,10 @@ RSpec.describe 'Requests' do it_behaves_like 'forbidden for wrong scope', 'read read:notifications' - it 'returns http success' do + it 'returns http success and creates notification permission' do subject expect(response).to have_http_status(200) - end - - it 'creates notification permission' do - subject - expect(NotificationPermission.find_by(account: notification_request.account, from_account: notification_request.from_account)).to_not be_nil end diff --git a/spec/requests/api/v1/profiles_spec.rb b/spec/requests/api/v1/profiles_spec.rb index 26a9b848e5..9616f41559 100644 --- a/spec/requests/api/v1/profiles_spec.rb +++ b/spec/requests/api/v1/profiles_spec.rb @@ -28,31 +28,14 @@ RSpec.describe 'Deleting profile images' do it_behaves_like 'forbidden for wrong scope', 'read' end - it 'returns http success' do + it 'returns http success and deletes the avatar, preserves the header, queues up distribution' do delete '/api/v1/profile/avatar', headers: headers expect(response).to have_http_status(200) - end - - it 'deletes the avatar' do - delete '/api/v1/profile/avatar', headers: headers account.reload - expect(account.avatar).to_not exist - end - - it 'does not delete the header' do - delete '/api/v1/profile/avatar', headers: headers - - account.reload - expect(account.header).to exist - end - - it 'queues up an account update distribution' do - delete '/api/v1/profile/avatar', headers: headers - expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id) end end @@ -66,31 +49,14 @@ RSpec.describe 'Deleting profile images' do it_behaves_like 'forbidden for wrong scope', 'read' end - it 'returns http success' do + it 'returns http success, preserves the avatar, deletes the header, queues up distribution' do delete '/api/v1/profile/header', headers: headers expect(response).to have_http_status(200) - end - - it 'does not delete the avatar' do - delete '/api/v1/profile/header', headers: headers account.reload - expect(account.avatar).to exist - end - - it 'deletes the header' do - delete '/api/v1/profile/header', headers: headers - - account.reload - expect(account.header).to_not exist - end - - it 'queues up an account update distribution' do - delete '/api/v1/profile/header', headers: headers - expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id) end end diff --git a/spec/requests/api/v1/statuses/bookmarks_spec.rb b/spec/requests/api/v1/statuses/bookmarks_spec.rb index f1bcfda0ff..6401a4370d 100644 --- a/spec/requests/api/v1/statuses/bookmarks_spec.rb +++ b/spec/requests/api/v1/statuses/bookmarks_spec.rb @@ -18,15 +18,11 @@ RSpec.describe 'Bookmarks' do it_behaves_like 'forbidden for wrong scope', 'read' context 'with public status' do - it 'bookmarks the status successfully', :aggregate_failures do + it 'bookmarks the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.bookmarked?(status)).to be true - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, bookmarked: true) @@ -93,15 +89,11 @@ RSpec.describe 'Bookmarks' do Bookmark.find_or_create_by!(account: user.account, status: status) end - it 'unbookmarks the status successfully', :aggregate_failures do + it 'unbookmarks the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.bookmarked?(status)).to be false - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, bookmarked: false) @@ -117,15 +109,11 @@ RSpec.describe 'Bookmarks' do status.account.block!(user.account) end - it 'unbookmarks the status successfully', :aggregate_failures do + it 'unbookmarks the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.bookmarked?(status)).to be false - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, bookmarked: false) diff --git a/spec/requests/api/v1/statuses/favourites_spec.rb b/spec/requests/api/v1/statuses/favourites_spec.rb index f9f0ff6299..c3acf0413e 100644 --- a/spec/requests/api/v1/statuses/favourites_spec.rb +++ b/spec/requests/api/v1/statuses/favourites_spec.rb @@ -18,15 +18,11 @@ RSpec.describe 'Favourites', :inline_jobs do it_behaves_like 'forbidden for wrong scope', 'read read:favourites' context 'with public status' do - it 'favourites the status successfully', :aggregate_failures do + it 'favourites the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.favourited?(status)).to be true - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, favourites_count: 1, favourited: true) @@ -84,16 +80,12 @@ RSpec.describe 'Favourites', :inline_jobs do FavouriteService.new.call(user.account, status) end - it 'unfavourites the status successfully', :aggregate_failures do + it 'unfavourites the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.favourited?(status)).to be false - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false) @@ -107,16 +99,12 @@ RSpec.describe 'Favourites', :inline_jobs do status.account.block!(user.account) end - it 'unfavourites the status successfully', :aggregate_failures do + it 'unfavourites the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.favourited?(status)).to be false - end - - it 'returns json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false) diff --git a/spec/requests/api/v1/statuses/pins_spec.rb b/spec/requests/api/v1/statuses/pins_spec.rb index 56e60c6d36..409c50e7c2 100644 --- a/spec/requests/api/v1/statuses/pins_spec.rb +++ b/spec/requests/api/v1/statuses/pins_spec.rb @@ -18,15 +18,11 @@ RSpec.describe 'Pins' do it_behaves_like 'forbidden for wrong scope', 'read read:accounts' context 'when the status is public' do - it 'pins the status successfully', :aggregate_failures do + it 'pins the status successfully and returns updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.pinned?(status)).to be true - end - - it 'return json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, pinned: true) @@ -86,15 +82,11 @@ RSpec.describe 'Pins' do Fabricate(:status_pin, status: status, account: user.account) end - it 'unpins the status successfully', :aggregate_failures do + it 'unpins the status successfully and includes updated json', :aggregate_failures do subject expect(response).to have_http_status(200) expect(user.account.pinned?(status)).to be false - end - - it 'return json with updated attributes' do - subject expect(response.parsed_body).to match( a_hash_including(id: status.id.to_s, pinned: false) diff --git a/spec/requests/api/v1/suggestions_spec.rb b/spec/requests/api/v1/suggestions_spec.rb index 8267bb92a0..b971f88129 100644 --- a/spec/requests/api/v1/suggestions_spec.rb +++ b/spec/requests/api/v1/suggestions_spec.rb @@ -23,15 +23,10 @@ RSpec.describe 'Suggestions' do it_behaves_like 'forbidden for wrong scope', 'write' - it 'returns http success' do + it 'returns http success with accounts' do subject expect(response).to have_http_status(200) - end - - it 'returns accounts' do - subject - expect(response.parsed_body) .to contain_exactly(include(id: bob.id.to_s), include(id: jeff.id.to_s)) end @@ -72,15 +67,10 @@ RSpec.describe 'Suggestions' do it_behaves_like 'forbidden for wrong scope', 'read' - it 'returns http success' do + it 'returns http success and removes suggestion' do subject expect(response).to have_http_status(200) - end - - it 'removes the specified suggestion' do - subject - expect(FollowRecommendationMute.exists?(account: user.account, target_account: jeff)).to be true end diff --git a/spec/requests/api/v1/timelines/home_spec.rb b/spec/requests/api/v1/timelines/home_spec.rb index afad2988ca..19a6f3adbc 100644 --- a/spec/requests/api/v1/timelines/home_spec.rb +++ b/spec/requests/api/v1/timelines/home_spec.rb @@ -31,14 +31,10 @@ RSpec.describe 'Home', :inline_jobs do PostStatusService.new.call(ana, text: 'New toot from ana.') end - it 'returns http success' do + it 'returns http success and statuses of followed users' do subject expect(response).to have_http_status(200) - end - - it 'returns the statuses of followed users' do - subject expect(response.parsed_body.pluck(:id)).to match_array(home_statuses.map { |status| status.id.to_s }) end @@ -46,14 +42,10 @@ RSpec.describe 'Home', :inline_jobs do context 'with limit param' do let(:params) { { limit: 1 } } - it 'returns only the requested number of statuses' do + it 'returns only the requested number of statuses with pagination headers', :aggregate_failures do subject expect(response.parsed_body.size).to eq(params[:limit]) - end - - it 'sets the correct pagination headers', :aggregate_failures do - subject expect(response) .to include_pagination_headers( diff --git a/spec/requests/api/v1/timelines/link_spec.rb b/spec/requests/api/v1/timelines/link_spec.rb index 8999364703..e1d421fb7a 100644 --- a/spec/requests/api/v1/timelines/link_spec.rb +++ b/spec/requests/api/v1/timelines/link_spec.rb @@ -123,15 +123,11 @@ RSpec.describe 'Link' do context 'with limit param' do let(:params) { { limit: 1, url: url } } - it 'returns only the requested number of statuses', :aggregate_failures do + it 'returns only the requested number of statuses with pagination headers', :aggregate_failures do subject expect(response).to have_http_status(200) expect(response.parsed_body.size).to eq(params[:limit]) - end - - it 'sets the correct pagination headers', :aggregate_failures do - subject expect(response) .to include_pagination_headers( diff --git a/spec/requests/api/v2/filters_spec.rb b/spec/requests/api/v2/filters_spec.rb index 850c773df3..ad8b55973e 100644 --- a/spec/requests/api/v2/filters_spec.rb +++ b/spec/requests/api/v2/filters_spec.rb @@ -49,14 +49,10 @@ RSpec.describe 'Filters' do context 'with valid params' do let(:params) { { title: 'magic', context: %w(home), filter_action: 'hide', keywords_attributes: [keyword: 'magic'] } } - it 'returns http success' do + it 'returns http success with a filter with keywords in json and creates a filter', :aggregate_failures do subject expect(response).to have_http_status(200) - end - - it 'returns a filter with keywords', :aggregate_failures do - subject expect(response.parsed_body) .to include( @@ -67,10 +63,6 @@ RSpec.describe 'Filters' do include(keyword: 'magic', whole_word: true) ) ) - end - - it 'creates a filter', :aggregate_failures do - subject filter = user.account.custom_filters.first @@ -189,20 +181,12 @@ RSpec.describe 'Filters' do allow(redis).to receive_messages(publish: nil) end - it 'returns http success' do + it 'returns http success and updates keyword and sends a filters_changed event' do subject expect(response).to have_http_status(200) - end - - it 'updates the keyword' do - subject expect(keyword.reload.keyword).to eq 'updated' - end - - it 'sends exactly one filters_changed event' do - subject expect(redis).to have_received(:publish).with("timeline:#{user.account.id}", Oj.dump(event: :filters_changed)).once end @@ -229,14 +213,10 @@ RSpec.describe 'Filters' do it_behaves_like 'forbidden for wrong scope', 'read read:filters' it_behaves_like 'unauthorized for invalid token' - it 'returns http success' do + it 'returns http success and removes the filter' do subject expect(response).to have_http_status(200) - end - - it 'removes the filter' do - subject expect { filter.reload }.to raise_error ActiveRecord::RecordNotFound end