.circleci
.github
app
bin
chart
config
db
dist
lib
log
nanobox
public
spec
controllers
activitypub
admin
api
auth
concerns
oauth
settings
well_known
about_controller_spec.rb
account_follow_controller_spec.rb
account_unfollow_controller_spec.rb
accounts_controller_spec.rb
application_controller_spec.rb
authorize_interactions_controller_spec.rb
emojis_controller_spec.rb
follower_accounts_controller_spec.rb
following_accounts_controller_spec.rb
home_controller_spec.rb
intents_controller_spec.rb
invites_controller_spec.rb
manifests_controller_spec.rb
media_controller_spec.rb
media_proxy_controller_spec.rb
relationships_controller_spec.rb
remote_follow_controller_spec.rb
remote_interaction_controller_spec.rb
shares_controller_spec.rb
statuses_controller_spec.rb
tags_controller_spec.rb
fabricators
features
fixtures
helpers
lib
mailers
models
policies
presenters
requests
routing
serializers
services
support
validators
views
workers
rails_helper.rb
spec_helper.rb
streaming
vendor
.buildpacks
.codeclimate.yml
.dockerignore
.editorconfig
.env.nanobox
.env.production.sample
.env.test
.env.vagrant
.eslintignore
.eslintrc.js
.foreman
.gitattributes
.gitignore
.haml-lint.yml
.nanoignore
.nvmrc
.profile
.rspec
.rubocop.yml
.ruby-version
.sass-lint.yml
.slugignore
.yarnclean
AUTHORS.md
Aptfile
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Capfile
Dockerfile
Gemfile
Gemfile.lock
LICENSE
Procfile
Procfile.dev
README.md
Rakefile
SECURITY.md
Vagrantfile
app.json
babel.config.js
boxfile.yml
config.ru
crowdin.yml
docker-compose.yml
ide-helper.js
package.json
postcss.config.js
priv-config
scalingo.json
yarn.lock
65 lines
1.4 KiB
Ruby
65 lines
1.4 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe AccountUnfollowController do
|
|
render_views
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
|
|
|
describe 'POST #create' do
|
|
let(:service) { double }
|
|
|
|
subject { post :create, params: { account_username: alice.username } }
|
|
|
|
before do
|
|
allow(UnfollowService).to receive(:new).and_return(service)
|
|
allow(service).to receive(:call)
|
|
end
|
|
|
|
context 'when account is permanently suspended' do
|
|
before do
|
|
alice.suspend!
|
|
alice.deletion_request.destroy
|
|
subject
|
|
end
|
|
|
|
it 'returns http gone' do
|
|
expect(response).to have_http_status(410)
|
|
end
|
|
end
|
|
|
|
context 'when account is temporarily suspended' do
|
|
before do
|
|
alice.suspend!
|
|
subject
|
|
end
|
|
|
|
it 'returns http forbidden' do
|
|
expect(response).to have_http_status(403)
|
|
end
|
|
end
|
|
|
|
context 'when signed out' do
|
|
before do
|
|
subject
|
|
end
|
|
|
|
it 'does not unfollow' do
|
|
expect(UnfollowService).not_to receive(:new)
|
|
end
|
|
end
|
|
|
|
context 'when signed in' do
|
|
before do
|
|
sign_in(user)
|
|
subject
|
|
end
|
|
|
|
it 'redirects to account path' do
|
|
expect(service).to have_received(:call).with(user.account, alice)
|
|
expect(response).to redirect_to(account_path(alice))
|
|
end
|
|
end
|
|
end
|
|
end
|