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

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

View File

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

View File

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