]>
cat aescling's git repositories - mastodon.git/blob - spec/controllers/api/v1/timelines_controller_spec.rb
3 RSpec
.describe Api
::V1::TimelinesController, type
: :controller do
6 let(:user) { Fabricate(:user, account
: Fabricate(:account, username
: 'alice')) }
9 stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
10 allow(controller
).to
receive(:doorkeeper_token) { token
}
13 context
'with a user context' do
14 let(:token) { double acceptable
?: true, resource_owner_id
: user
.id
}
16 describe
'GET #home' do
17 it
'returns http success' do
19 expect(response
).to
have_http_status(:success)
23 describe
'GET #mentions' do
24 it
'returns http success' do
26 expect(response
).to
have_http_status(:success)
30 describe
'GET #public' do
31 it
'returns http success' do
33 expect(response
).to
have_http_status(:success)
37 describe
'GET #tag' do
39 PostStatusService
.new
.call(user
.account
, 'It is a #test')
42 it
'returns http success' do
43 get
:tag, params
: { id
: 'test' }
44 expect(response
).to
have_http_status(:success)
49 context
'without a user context' do
50 let(:token) { double acceptable
?: true, resource_owner_id
: nil }
52 describe
'GET #home' do
53 it
'returns http unprocessable entity' do
55 expect(response
).to
have_http_status(:unprocessable_entity)
59 describe
'GET #mentions' do
60 it
'returns http unprocessable entity' do
62 expect(response
).to
have_http_status(:unprocessable_entity)
66 describe
'GET #public' do
67 it
'returns http success' do
69 expect(response
).to
have_http_status(:success)
73 describe
'GET #tag' do
74 it
'returns http success' do
75 get
:tag, params
: { id
: 'test' }
76 expect(response
).to
have_http_status(:success)
This page took 0.109427 seconds and 6 git commands to generate.