app
bin
config
db
docs
lib
log
public
spec
controllers
admin
api
v1
accounts_controller_spec.rb
apps_controller_spec.rb
blocks_controller_spec.rb
favourites_controller_spec.rb
follow_requests_controller_spec.rb
follows_controller_spec.rb
media_controller_spec.rb
mutes_controller_spec.rb
notifications_controller_spec.rb
statuses_controller_spec.rb
timelines_controller_spec.rb
oembed_controller_spec.rb
push_controller_spec.rb
salmon_controller_spec.rb
subscriptions_controller_spec.rb
auth
oauth
settings
well_known
about_controller_spec.rb
accounts_controller_spec.rb
authorize_follow_controller_spec.rb
home_controller_spec.rb
stream_entries_controller_spec.rb
tags_controller_spec.rb
fabricators
features
fixtures
helpers
javascript
lib
mailers
models
presenters
requests
routing
services
support
views
i18n_spec.rb
rails_helper.rb
spec_helper.rb
storybook
streaming
vendor
.babelrc
.buildpacks
.codeclimate.yml
.dockerignore
.editorconfig
.env.production.sample
.env.test
.env.vagrant
.eslintignore
.eslintrc
.gitignore
.nvmrc
.rspec
.rubocop.yml
.ruby-version
.slugignore
.travis.yml
CONTRIBUTING.md
Capfile
Dockerfile
Gemfile
Gemfile.lock
ISSUE_TEMPLATE.md
LICENSE
Procfile
README.md
Rakefile
Vagrantfile
app.json
config.ru
docker-compose.yml
package.json
scalingo.json
yarn.lock
66 lines
1.6 KiB
Ruby
66 lines
1.6 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe Api::V1::TimelinesController, type: :controller do
|
|
render_views
|
|
|
|
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
|
|
|
before do
|
|
allow(controller).to receive(:doorkeeper_token) { token }
|
|
end
|
|
|
|
context 'with a user context' do
|
|
let(:token) { double acceptable?: true, resource_owner_id: user.id }
|
|
|
|
describe 'GET #home' do
|
|
it 'returns http success' do
|
|
get :home
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
|
|
describe 'GET #public' do
|
|
it 'returns http success' do
|
|
get :public
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
|
|
describe 'GET #tag' do
|
|
before do
|
|
PostStatusService.new.call(user.account, 'It is a #test')
|
|
end
|
|
|
|
it 'returns http success' do
|
|
get :tag, params: { id: 'test' }
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
end
|
|
|
|
context 'without a user context' do
|
|
let(:token) { double acceptable?: true, resource_owner_id: nil }
|
|
|
|
describe 'GET #home' do
|
|
it 'returns http unprocessable entity' do
|
|
get :home
|
|
expect(response).to have_http_status(:unprocessable_entity)
|
|
end
|
|
end
|
|
|
|
describe 'GET #public' do
|
|
it 'returns http success' do
|
|
get :public
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
|
|
describe 'GET #tag' do
|
|
it 'returns http success' do
|
|
get :tag, params: { id: 'test' }
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
end
|
|
end
|