3 describe FollowerAccountsController
do
6 let(:alice) { Fabricate(:account, username
: 'alice') }
7 let(:follower0) { Fabricate(:account) }
8 let(:follower1) { Fabricate(:account) }
10 describe
'GET #index' do
11 let!
(:follow0) { follower0
.follow!
(alice
) }
12 let!
(:follow1) { follower1
.follow!
(alice
) }
14 context
'when format is html' do
15 subject(:response) { get
:index, params
: { account_username
: alice
.username
, format
: :html } }
17 it
'assigns follows' do
18 expect(response
).to
have_http_status(200)
20 assigned
= assigns(:follows).to_a
21 expect(assigned
.size
).to eq
2
22 expect(assigned
[0]).to eq follow1
23 expect(assigned
[1]).to eq follow0
27 context
'when format is json' do
28 subject(:response) { get
:index, params
: { account_username
: alice
.username
, page
: page
, format
: :json } }
29 subject(:body) { JSON
.parse(response
.body
) }
31 context
'with page' do
34 it
'returns followers' do
35 expect(response
).to
have_http_status(200)
36 expect(body
['totalItems']).to eq
2
37 expect(body
['partOf']).to be_present
41 context
'without page' do
44 it
'returns followers' do
45 expect(response
).to
have_http_status(200)
46 expect(body
['totalItems']).to eq
2
47 expect(body
['partOf']).to be_blank