about summary refs log tree commit diff
path: root/spec/routing
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-19 07:52:37 -0400
committerEugen <eugen@zeonfederated.com>2017-04-19 13:52:37 +0200
commit8bac0350d16cb8e2770c089c91d71f8038404de5 (patch)
treef5b381319fde16fbe393dbae2cba1691f17aea9a /spec/routing
parentc0b30c56db36d0064ee7618976ab4e25f7a675fd (diff)
Restful refactor of accounts/ routes (#2133)
* Add routing specs for accounts followers and following actions

* Use more restful route naming for public account follow pages

Moves two actions:
- accounts#followers to accounts/follower_accounts#index
- accounts#following to accounts/following_accounts#index

Adds routing spec to ensure prior URLs are preserved.
Diffstat (limited to 'spec/routing')
-rw-r--r--spec/routing/accounts_routing_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/routing/accounts_routing_spec.rb b/spec/routing/accounts_routing_spec.rb
new file mode 100644
index 000000000..d04cb27f0
--- /dev/null
+++ b/spec/routing/accounts_routing_spec.rb
@@ -0,0 +1,31 @@
+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')
+    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')
+    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')
+    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')
+    end
+  end
+end