Move `api/v1/trends/*` to request specs (#28949)

shrike
Matt Jankowski 2024-01-26 12:40:39 -05:00 committed by GitHub
parent 0b0ca6f3b8
commit 7adcc0aae3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 18 deletions

View File

@ -2,15 +2,13 @@
require 'rails_helper'
RSpec.describe Api::V1::Trends::LinksController do
render_views
describe 'GET #index' do
RSpec.describe 'API V1 Trends Links' do
describe 'GET /api/v1/trends/links' do
context 'when trends are disabled' do
before { Setting.trends = false }
it 'returns http success' do
get :index
get '/api/v1/trends/links'
expect(response).to have_http_status(200)
end
@ -22,7 +20,7 @@ RSpec.describe Api::V1::Trends::LinksController do
it 'returns http success' do
prepare_trends
stub_const('Api::V1::Trends::LinksController::DEFAULT_LINKS_LIMIT', 2)
get :index
get '/api/v1/trends/links'
expect(response).to have_http_status(200)
expect(response.headers).to include('Link')

View File

@ -2,15 +2,13 @@
require 'rails_helper'
RSpec.describe Api::V1::Trends::StatusesController do
render_views
describe 'GET #index' do
RSpec.describe 'API V1 Trends Statuses' do
describe 'GET /api/v1/trends/statuses' do
context 'when trends are disabled' do
before { Setting.trends = false }
it 'returns http success' do
get :index
get '/api/v1/trends/statuses'
expect(response).to have_http_status(200)
end
@ -22,7 +20,7 @@ RSpec.describe Api::V1::Trends::StatusesController do
it 'returns http success' do
prepare_trends
stub_const('Api::BaseController::DEFAULT_STATUSES_LIMIT', 2)
get :index
get '/api/v1/trends/statuses'
expect(response).to have_http_status(200)
expect(response.headers).to include('Link')

View File

@ -2,15 +2,13 @@
require 'rails_helper'
RSpec.describe Api::V1::Trends::TagsController do
render_views
describe 'GET #index' do
RSpec.describe 'API V1 Trends Tags' do
describe 'GET /api/v1/trends/tags' do
context 'when trends are disabled' do
before { Setting.trends = false }
it 'returns http success' do
get :index
get '/api/v1/trends/tags'
expect(response).to have_http_status(200)
expect(response.headers).to_not include('Link')
@ -23,7 +21,7 @@ RSpec.describe Api::V1::Trends::TagsController do
it 'returns http success' do
prepare_trends
stub_const('Api::V1::Trends::TagsController::DEFAULT_TAGS_LIMIT', 2)
get :index
get '/api/v1/trends/tags'
expect(response).to have_http_status(200)
expect(response.headers).to include('Link')