From 8f6e290c7abf0c9792643142991c9deaa700af6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Marques?= <64037198+TheDevJoao@users.noreply.github.com> Date: Sun, 30 Apr 2023 04:01:42 -0300 Subject: [PATCH] Adds new follower/following routes (#24601) --- config/routes.rb | 2 ++ spec/requests/follower_accounts_spec.rb | 13 +++++++++++++ spec/requests/following_accounts_spec.rb | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 spec/requests/follower_accounts_spec.rb create mode 100644 spec/requests/following_accounts_spec.rb diff --git a/config/routes.rb b/config/routes.rb index 3be088cee..c09c5175a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -83,6 +83,8 @@ Rails.application.routes.draw do } get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? } + get '/users/:username/following', to: redirect('/@%{username}/following'), constraints: lambda { |req| req.format.nil? || req.format.html? } + get '/users/:username/followers', to: redirect('/@%{username}/followers'), constraints: lambda { |req| req.format.nil? || req.format.html? } get '/users/:username/statuses/:id', to: redirect('/@%{username}/%{id}'), constraints: lambda { |req| req.format.nil? || req.format.html? } get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" } diff --git a/spec/requests/follower_accounts_spec.rb b/spec/requests/follower_accounts_spec.rb new file mode 100644 index 000000000..52e86e13f --- /dev/null +++ b/spec/requests/follower_accounts_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'FollowerAccountsController' do + describe 'The follower_accounts route' do + it "returns a http 'moved_permanently' code" do + get '/users/:username/followers' + + expect(response).to have_http_status(301) + end + end +end diff --git a/spec/requests/following_accounts_spec.rb b/spec/requests/following_accounts_spec.rb new file mode 100644 index 000000000..f0955ceb3 --- /dev/null +++ b/spec/requests/following_accounts_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'FollowingAccountsController' do + describe 'The following_accounts route' do + it "returns a http 'moved_permanently' code" do + get '/users/:username/following' + + expect(response).to have_http_status(301) + end + end +end