about summary refs log tree commit diff
path: root/spec/routing/accounts_routing_spec.rb
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-11-10 08:50:11 -0600
committerStarfall <us@starfall.systems>2022-11-10 08:50:11 -0600
commit67d1a0476d77e2ed0ca15dd2981c54c2b90b0742 (patch)
tree152f8c13a341d76738e8e2c09b24711936e6af68 /spec/routing/accounts_routing_spec.rb
parentb581e6b6d4a5ba9ed4ae17427b7f2d5d158be4e5 (diff)
parentee7e49d1b1323618e16026bc8db8ab7f9459cc2d (diff)
Merge remote-tracking branch 'glitch/main'
- Remove Helm charts
- Lots of conflicts with our removal of recommended settings and custom
  icons
Diffstat (limited to 'spec/routing/accounts_routing_spec.rb')
-rw-r--r--spec/routing/accounts_routing_spec.rb88
1 files changed, 70 insertions, 18 deletions
diff --git a/spec/routing/accounts_routing_spec.rb b/spec/routing/accounts_routing_spec.rb
index d04cb27f0..3f0e9b3e9 100644
--- a/spec/routing/accounts_routing_spec.rb
+++ b/spec/routing/accounts_routing_spec.rb
@@ -1,31 +1,83 @@
 require 'rails_helper'
 
 describe 'Routes under accounts/' do
-  describe 'the route for accounts who are followers of an account' do
-    it 'routes to the followers action with the right username' do
-      expect(get('/users/name/followers')).
-        to route_to('follower_accounts#index', account_username: 'name')
+  context 'with local username' do
+    let(:username) { 'alice' }
+
+    it 'routes /@:username' do
+      expect(get("/@#{username}")).to route_to('accounts#show', username: username)
     end
-  end
 
-  describe 'the route for accounts who are followed by an account' do
-    it 'routes to the following action with the right username' do
-      expect(get('/users/name/following')).
-        to route_to('following_accounts#index', account_username: 'name')
+    it 'routes /@:username.json' do
+      expect(get("/@#{username}.json")).to route_to('accounts#show', username: username, format: 'json')
+    end
+
+    it 'routes /@:username.rss' do
+      expect(get("/@#{username}.rss")).to route_to('accounts#show', username: username, format: 'rss')
+    end
+
+    it 'routes /@:username/:id' do
+      expect(get("/@#{username}/123")).to route_to('statuses#show', account_username: username, id: '123')
+    end
+
+    it 'routes /@:username/:id/embed' do
+      expect(get("/@#{username}/123/embed")).to route_to('statuses#embed', account_username: username, id: '123')
+    end
+
+    it 'routes /@:username/following' do
+      expect(get("/@#{username}/following")).to route_to('following_accounts#index', account_username: username)
+    end
+
+    it 'routes /@:username/followers' do
+      expect(get("/@#{username}/followers")).to route_to('follower_accounts#index', account_username: username)
+    end
+
+    it 'routes /@:username/with_replies' do
+      expect(get("/@#{username}/with_replies")).to route_to('accounts#show', username: username)
+    end
+
+    it 'routes /@:username/media' do
+      expect(get("/@#{username}/media")).to route_to('accounts#show', username: username)
     end
-  end
 
-  describe 'the route for following an account' do
-    it 'routes to the follow create action with the right username' do
-      expect(post('/users/name/follow')).
-        to route_to('account_follow#create', account_username: 'name')
+    it 'routes /@:username/tagged/:tag' do
+      expect(get("/@#{username}/tagged/foo")).to route_to('accounts#show', username: username, tag: 'foo')
     end
   end
 
-  describe 'the route for unfollowing an account' do
-    it 'routes to the unfollow create action with the right username' do
-      expect(post('/users/name/unfollow')).
-        to route_to('account_unfollow#create', account_username: 'name')
+  context 'with remote username' do
+    let(:username) { 'alice@example.com' }
+
+    it 'routes /@:username' do
+      expect(get("/@#{username}")).to route_to('home#index', username_with_domain: username)
+    end
+
+    it 'routes /@:username/:id' do
+      expect(get("/@#{username}/123")).to route_to('home#index', username_with_domain: username, any: '123')
+    end
+
+    it 'routes /@:username/:id/embed' do
+      expect(get("/@#{username}/123/embed")).to route_to('home#index', username_with_domain: username, any: '123/embed')
+    end
+
+    it 'routes /@:username/following' do
+      expect(get("/@#{username}/following")).to route_to('home#index', username_with_domain: username, any: 'following')
+    end
+
+    it 'routes /@:username/followers' do
+      expect(get("/@#{username}/followers")).to route_to('home#index', username_with_domain: username, any: 'followers')
+    end
+
+    it 'routes /@:username/with_replies' do
+      expect(get("/@#{username}/with_replies")).to route_to('home#index', username_with_domain: username, any: 'with_replies')
+    end
+
+    it 'routes /@:username/media' do
+      expect(get("/@#{username}/media")).to route_to('home#index', username_with_domain: username, any: 'media')
+    end
+
+    it 'routes /@:username/tagged/:tag' do
+      expect(get("/@#{username}/tagged/foo")).to route_to('home#index', username_with_domain: username, any: 'tagged/foo')
     end
   end
 end