From 7adcc0aae3cadf946411192e680be9e1b7af9d7a Mon Sep 17 00:00:00 2001
From: Matt Jankowski <matt@jankowski.online>
Date: Fri, 26 Jan 2024 12:40:39 -0500
Subject: [PATCH] Move `api/v1/trends/*` to request specs (#28949)

---
 .../api/v1/trends/links_spec.rb}                       | 10 ++++------
 .../api/v1/trends/statuses_spec.rb}                    | 10 ++++------
 .../api/v1/trends/tags_spec.rb}                        | 10 ++++------
 3 files changed, 12 insertions(+), 18 deletions(-)
 rename spec/{controllers/api/v1/trends/links_controller_spec.rb => requests/api/v1/trends/links_spec.rb} (84%)
 rename spec/{controllers/api/v1/trends/statuses_controller_spec.rb => requests/api/v1/trends/statuses_spec.rb} (83%)
 rename spec/{controllers/api/v1/trends/tags_controller_spec.rb => requests/api/v1/trends/tags_spec.rb} (85%)

diff --git a/spec/controllers/api/v1/trends/links_controller_spec.rb b/spec/requests/api/v1/trends/links_spec.rb
similarity index 84%
rename from spec/controllers/api/v1/trends/links_controller_spec.rb
rename to spec/requests/api/v1/trends/links_spec.rb
index bcaf066f1..012d03590 100644
--- a/spec/controllers/api/v1/trends/links_controller_spec.rb
+++ b/spec/requests/api/v1/trends/links_spec.rb
@@ -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')
diff --git a/spec/controllers/api/v1/trends/statuses_controller_spec.rb b/spec/requests/api/v1/trends/statuses_spec.rb
similarity index 83%
rename from spec/controllers/api/v1/trends/statuses_controller_spec.rb
rename to spec/requests/api/v1/trends/statuses_spec.rb
index 25ab5f228..3b906e8f8 100644
--- a/spec/controllers/api/v1/trends/statuses_controller_spec.rb
+++ b/spec/requests/api/v1/trends/statuses_spec.rb
@@ -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')
diff --git a/spec/controllers/api/v1/trends/tags_controller_spec.rb b/spec/requests/api/v1/trends/tags_spec.rb
similarity index 85%
rename from spec/controllers/api/v1/trends/tags_controller_spec.rb
rename to spec/requests/api/v1/trends/tags_spec.rb
index c889f1c5b..598f4e775 100644
--- a/spec/controllers/api/v1/trends/tags_controller_spec.rb
+++ b/spec/requests/api/v1/trends/tags_spec.rb
@@ -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')