Merge commit 'f877aa9d70d0d600961989b8e97c0e0ce3ac1db6' into glitch-soc/merge-upstream
Conflicts: - `.github/dependabot.yml`: Upstream made changes, but we had removed it. Discarded upstream changes. - `.rubocop_todo.yml`: Upstream regenerated the file, we had some glitch-soc-specific ignores. - `app/models/account_statuses_filter.rb`: Minor upstream code style change where glitch-soc had slightly different code due to handling of local-only posts. Updated to match upstream's code style. - `app/models/status.rb`: Upstream moved ActiveRecord callback definitions, glitch-soc had an extra one. Moved the definitions as upstream did. - `app/services/backup_service.rb`: Upstream rewrote a lot of the backup service, glitch-soc had changes because of exporting local-only posts. Took upstream changes and added back code to deal with local-only posts. - `config/routes.rb`: Upstream split the file into different files, while glitch-soc had a few extra routes. Extra routes added to `config/routes/settings.rb`, `config/routes/api.rb` and `config/routes/admin.rb` - `db/schema.rb`: Upstream has new migrations, while glitch-soc had an extra migration. Updated the expected serial number to match upstream's. - `lib/mastodon/version.rb`: Upstream added support to set version tags from environment variables, while glitch-soc has an extra `+glitch` tag. Changed the code to support upstream's feature but prepending a `+glitch`. - `spec/lib/activitypub/activity/create_spec.rb`: Minor code style change upstream, while glitch-soc has extra tests due to `directMessage` handling. Applied upstream's changes while keeping glitch-soc's extra tests. - `spec/models/concerns/account_interactions_spec.rb`: Minor code style change upstream, while glitch-soc has extra tests. Applied upstream's changes while keeping glitch-soc's extra tests.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AboutController, type: :controller do
|
||||
RSpec.describe AboutController do
|
||||
render_views
|
||||
|
||||
describe 'GET #show' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountsController, type: :controller do
|
||||
RSpec.describe AccountsController do
|
||||
render_views
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
@@ -57,7 +57,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it_behaves_like 'preliminary checks'
|
||||
@@ -140,7 +140,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:authorized_fetch_mode) { false }
|
||||
let(:format) { 'json' }
|
||||
|
||||
@@ -193,7 +193,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
expect(json).to include(:id, :type, :preferredUsername, :inbox, :publicKey, :name, :summary)
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { true }
|
||||
|
||||
it 'returns http unauthorized' do
|
||||
@@ -251,7 +251,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
expect(json).to include(:id, :type, :preferredUsername, :inbox, :publicKey, :name, :summary)
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { true }
|
||||
|
||||
it 'returns http success' do
|
||||
@@ -278,7 +278,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'as RSS' do
|
||||
context 'with RSS' do
|
||||
let(:format) { 'rss' }
|
||||
|
||||
it_behaves_like 'preliminary checks'
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
||||
RSpec.describe ActivityPub::CollectionsController do
|
||||
let!(:account) { Fabricate(:account) }
|
||||
let!(:private_pinned) { Fabricate(:status, account: account, text: 'secret private stuff', visibility: :private) }
|
||||
let(:remote_account) { nil }
|
||||
@@ -35,10 +35,9 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
||||
describe 'GET #show' do
|
||||
context 'when id is "featured"' do
|
||||
context 'without signature' do
|
||||
subject(:body) { body_as_json }
|
||||
|
||||
subject(:response) { get :show, params: { id: 'featured', account_username: account.username } }
|
||||
|
||||
let(:body) { body_as_json }
|
||||
let(:remote_account) { nil }
|
||||
|
||||
it 'returns http success' do
|
||||
@@ -120,7 +119,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
before do
|
||||
allow(controller).to receive(:authorized_fetch_mode?).and_return(true)
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controller do
|
||||
RSpec.describe ActivityPub::FollowersSynchronizationsController do
|
||||
let!(:account) { Fabricate(:account) }
|
||||
let!(:follower_1) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/a') }
|
||||
let!(:follower_2) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/b') }
|
||||
@@ -34,10 +34,9 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
|
||||
end
|
||||
|
||||
context 'with signature from example.com' do
|
||||
subject(:body) { body_as_json }
|
||||
|
||||
subject(:response) { get :show, params: { account_username: account.username } }
|
||||
|
||||
let(:body) { body_as_json }
|
||||
let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::InboxesController, type: :controller do
|
||||
RSpec.describe ActivityPub::InboxesController do
|
||||
let(:remote_account) { nil }
|
||||
|
||||
before do
|
||||
@@ -21,7 +21,7 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do
|
||||
expect(response).to have_http_status(202)
|
||||
end
|
||||
|
||||
context 'for a specific account' do
|
||||
context 'with a specific account' do
|
||||
subject(:response) { post :create, params: { account_username: account.username }, body: '{}' }
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::OutboxesController, type: :controller do
|
||||
RSpec.describe ActivityPub::OutboxesController do
|
||||
let!(:account) { Fabricate(:account) }
|
||||
|
||||
shared_examples 'cacheable response' do
|
||||
@@ -35,10 +35,9 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
|
||||
|
||||
describe 'GET #show' do
|
||||
context 'without signature' do
|
||||
subject(:body) { body_as_json }
|
||||
|
||||
subject(:response) { get :show, params: { account_username: account.username, page: page } }
|
||||
|
||||
let(:body) { body_as_json }
|
||||
let(:remote_account) { nil }
|
||||
|
||||
context 'with page not requested' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::RepliesController, type: :controller do
|
||||
RSpec.describe ActivityPub::RepliesController do
|
||||
let(:status) { Fabricate(:status, visibility: parent_visibility) }
|
||||
let(:remote_account) { Fabricate(:account, domain: 'foobar.com') }
|
||||
let(:remote_reply_id) { 'https://foobar.com/statuses/1234' }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::AccountModerationNotesController, type: :controller do
|
||||
RSpec.describe Admin::AccountModerationNotesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::AccountsController, type: :controller do
|
||||
RSpec.describe Admin::AccountsController do
|
||||
render_views
|
||||
|
||||
before { sign_in current_user, scope: :user }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::ActionLogsController, type: :controller do
|
||||
describe Admin::ActionLogsController do
|
||||
render_views
|
||||
|
||||
# Action logs typically cause issues when their targets are not in the database
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::BaseController, type: :controller do
|
||||
describe Admin::BaseController do
|
||||
controller do
|
||||
def success
|
||||
authorize :dashboard, :index?
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
||||
RSpec.describe Admin::ChangeEmailsController do
|
||||
render_views
|
||||
|
||||
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::ConfirmationsController, type: :controller do
|
||||
RSpec.describe Admin::ConfirmationsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::DashboardController, type: :controller do
|
||||
describe Admin::DashboardController do
|
||||
render_views
|
||||
|
||||
describe 'GET #index' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::Disputes::AppealsController, type: :controller do
|
||||
RSpec.describe Admin::Disputes::AppealsController do
|
||||
render_views
|
||||
|
||||
before { sign_in current_user, scope: :user }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::DomainAllowsController, type: :controller do
|
||||
RSpec.describe Admin::DomainAllowsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::DomainBlocksController, type: :controller do
|
||||
RSpec.describe Admin::DomainBlocksController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
@@ -83,7 +83,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
|
||||
BlockDomainService.new.call(domain_block)
|
||||
end
|
||||
|
||||
context 'downgrading a domain suspension to silence' do
|
||||
context 'when downgrading a domain suspension to silence' do
|
||||
let(:original_severity) { 'suspend' }
|
||||
let(:new_severity) { 'silence' }
|
||||
|
||||
@@ -100,7 +100,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'upgrading a domain silence to suspend' do
|
||||
context 'when upgrading a domain silence to suspend' do
|
||||
let(:original_severity) { 'silence' }
|
||||
let(:new_severity) { 'suspend' }
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
|
||||
RSpec.describe Admin::EmailDomainBlocksController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::ExportDomainAllowsController, type: :controller do
|
||||
RSpec.describe Admin::ExportDomainAllowsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::ExportDomainBlocksController, type: :controller do
|
||||
RSpec.describe Admin::ExportDomainBlocksController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::InstancesController, type: :controller do
|
||||
RSpec.describe Admin::InstancesController do
|
||||
render_views
|
||||
|
||||
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
@@ -15,7 +15,7 @@ describe Admin::Reports::ActionsController do
|
||||
let(:report) { Fabricate(:report) }
|
||||
|
||||
before do
|
||||
post :preview, params: { report_id: report.id, action => '' }
|
||||
post :preview, params: { :report_id => report.id, action => '' }
|
||||
end
|
||||
|
||||
context 'when the action is "suspend"' do
|
||||
@@ -146,13 +146,13 @@ describe Admin::Reports::ActionsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'action as submit button' do
|
||||
context 'with Action as submit button' do
|
||||
subject { post :create, params: common_params.merge({ action => '' }) }
|
||||
|
||||
it_behaves_like 'all action types'
|
||||
end
|
||||
|
||||
context 'action as submit button' do
|
||||
context 'with Action as submit button' do
|
||||
subject { post :create, params: common_params.merge({ moderation_action: action }) }
|
||||
|
||||
it_behaves_like 'all action types'
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::Settings::BrandingController, type: :controller do
|
||||
RSpec.describe Admin::Settings::BrandingController do
|
||||
render_views
|
||||
|
||||
describe 'When signed in as an admin' do
|
||||
|
@@ -30,7 +30,7 @@ describe Admin::StatusesController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'filtering by media' do
|
||||
context 'when filtering by media' do
|
||||
before do
|
||||
get :index, params: { account_id: account.id, media: '1' }
|
||||
end
|
||||
@@ -43,7 +43,7 @@ describe Admin::StatusesController do
|
||||
|
||||
describe 'POST #batch' do
|
||||
before do
|
||||
post :batch, params: { account_id: account.id, action => '', admin_status_batch_action: { status_ids: status_ids } }
|
||||
post :batch, params: { :account_id => account.id, action => '', :admin_status_batch_action => { status_ids: status_ids } }
|
||||
end
|
||||
|
||||
let(:status_ids) { [media_attached_status.id] }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::TagsController, type: :controller do
|
||||
RSpec.describe Admin::TagsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
|
@@ -2,9 +2,11 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
class FakeService; end
|
||||
|
||||
describe Api::BaseController do
|
||||
before do
|
||||
stub_const('FakeService', Class.new)
|
||||
end
|
||||
|
||||
controller do
|
||||
def success
|
||||
head 200
|
||||
@@ -72,7 +74,11 @@ describe Api::BaseController do
|
||||
end
|
||||
|
||||
describe 'error handling' do
|
||||
ERRORS_WITH_CODES = {
|
||||
before do
|
||||
routes.draw { get 'error' => 'api/base#error' }
|
||||
end
|
||||
|
||||
{
|
||||
ActiveRecord::RecordInvalid => 422,
|
||||
Mastodon::ValidationError => 422,
|
||||
ActiveRecord::RecordNotFound => 404,
|
||||
@@ -80,13 +86,7 @@ describe Api::BaseController do
|
||||
HTTP::Error => 503,
|
||||
OpenSSL::SSL::SSLError => 503,
|
||||
Mastodon::NotPermittedError => 403,
|
||||
}
|
||||
|
||||
before do
|
||||
routes.draw { get 'error' => 'api/base#error' }
|
||||
end
|
||||
|
||||
ERRORS_WITH_CODES.each do |error, code|
|
||||
}.each do |error, code|
|
||||
it "Handles error class of #{error}" do
|
||||
expect(FakeService).to receive(:new).and_raise(error)
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::OEmbedController, type: :controller do
|
||||
RSpec.describe Api::OEmbedController do
|
||||
render_views
|
||||
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Accounts::PinsController, type: :controller do
|
||||
RSpec.describe Api::V1::Accounts::PinsController do
|
||||
let(:john) { Fabricate(:user) }
|
||||
let(:kevin) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: john.id, scopes: 'write:accounts') }
|
||||
|
@@ -21,7 +21,7 @@ describe Api::V1::Accounts::RelationshipsController do
|
||||
lewis.follow!(user.account)
|
||||
end
|
||||
|
||||
context 'provided only one ID' do
|
||||
context 'when provided only one ID' do
|
||||
before do
|
||||
get :index, params: { id: simon.id }
|
||||
end
|
||||
@@ -39,7 +39,7 @@ describe Api::V1::Accounts::RelationshipsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'provided multiple IDs' do
|
||||
context 'when provided multiple IDs' do
|
||||
before do
|
||||
get :index, params: { id: [simon.id, lewis.id] }
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Accounts::SearchController, type: :controller do
|
||||
RSpec.describe Api::V1::Accounts::SearchController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||
RSpec.describe Api::V1::AccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
@@ -30,7 +30,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||
post :create, params: { username: 'test', password: '12345678', email: 'hello@world.tld', agreement: agreement }
|
||||
end
|
||||
|
||||
context 'given truthy agreement' do
|
||||
context 'when given truthy agreement' do
|
||||
let(:agreement) { 'true' }
|
||||
|
||||
it 'returns http success' do
|
||||
@@ -48,7 +48,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'given no agreement' do
|
||||
context 'when given no agreement' do
|
||||
it 'returns http unprocessable entity' do
|
||||
expect(response).to have_http_status(422)
|
||||
end
|
||||
@@ -121,7 +121,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'modifying follow options' do
|
||||
context 'when modifying follow options' do
|
||||
let(:locked) { false }
|
||||
|
||||
before do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Admin::AccountActionsController, type: :controller do
|
||||
RSpec.describe Api::V1::Admin::AccountActionsController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Moderator') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Admin::AccountsController, type: :controller do
|
||||
RSpec.describe Api::V1::Admin::AccountsController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Moderator') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Admin::DomainAllowsController, type: :controller do
|
||||
RSpec.describe Api::V1::Admin::DomainAllowsController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Admin') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
|
||||
RSpec.describe Api::V1::Admin::DomainBlocksController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Admin') }
|
||||
@@ -84,7 +84,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
|
||||
BlockDomainService.new.call(domain_block)
|
||||
end
|
||||
|
||||
context 'downgrading a domain suspension to silence' do
|
||||
context 'when downgrading a domain suspension to silence' do
|
||||
let(:original_severity) { 'suspend' }
|
||||
let(:new_severity) { 'silence' }
|
||||
|
||||
@@ -101,7 +101,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'upgrading a domain silence to suspend' do
|
||||
context 'when upgrading a domain silence to suspend' do
|
||||
let(:original_severity) { 'silence' }
|
||||
let(:new_severity) { 'suspend' }
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Admin::ReportsController, type: :controller do
|
||||
RSpec.describe Api::V1::Admin::ReportsController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Moderator') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Announcements::ReactionsController, type: :controller do
|
||||
RSpec.describe Api::V1::Announcements::ReactionsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::AnnouncementsController, type: :controller do
|
||||
RSpec.describe Api::V1::AnnouncementsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::AppsController, type: :controller do
|
||||
RSpec.describe Api::V1::AppsController do
|
||||
render_views
|
||||
|
||||
describe 'POST #create' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::BlocksController, type: :controller do
|
||||
RSpec.describe Api::V1::BlocksController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
@@ -13,13 +13,13 @@ RSpec.describe Api::V1::BlocksController, type: :controller do
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'limits according to limit parameter' do
|
||||
2.times.map { Fabricate(:block, account: user.account) }
|
||||
Array.new(2) { Fabricate(:block, account: user.account) }
|
||||
get :index, params: { limit: 1 }
|
||||
expect(body_as_json.size).to eq 1
|
||||
end
|
||||
|
||||
it 'queries blocks in range according to max_id' do
|
||||
blocks = 2.times.map { Fabricate(:block, account: user.account) }
|
||||
blocks = Array.new(2) { Fabricate(:block, account: user.account) }
|
||||
|
||||
get :index, params: { max_id: blocks[1] }
|
||||
|
||||
@@ -28,7 +28,7 @@ RSpec.describe Api::V1::BlocksController, type: :controller do
|
||||
end
|
||||
|
||||
it 'queries blocks in range according to since_id' do
|
||||
blocks = 2.times.map { Fabricate(:block, account: user.account) }
|
||||
blocks = Array.new(2) { Fabricate(:block, account: user.account) }
|
||||
|
||||
get :index, params: { since_id: blocks[0] }
|
||||
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Api::V1::BlocksController, type: :controller do
|
||||
end
|
||||
|
||||
it 'sets pagination header for next path' do
|
||||
blocks = 2.times.map { Fabricate(:block, account: user.account) }
|
||||
blocks = Array.new(2) { Fabricate(:block, account: user.account) }
|
||||
get :index, params: { limit: 1, since_id: blocks[0] }
|
||||
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq api_v1_blocks_url(limit: 1, max_id: blocks[1])
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::BookmarksController, type: :controller do
|
||||
RSpec.describe Api::V1::BookmarksController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::ConversationsController, type: :controller do
|
||||
RSpec.describe Api::V1::ConversationsController do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user, account_attributes: { username: 'alice' }) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::CustomEmojisController, type: :controller do
|
||||
RSpec.describe Api::V1::CustomEmojisController do
|
||||
render_views
|
||||
|
||||
describe 'GET #index' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::DomainBlocksController, type: :controller do
|
||||
RSpec.describe Api::V1::DomainBlocksController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
||||
RSpec.describe Api::V1::Emails::ConfirmationsController do
|
||||
let(:confirmed_at) { nil }
|
||||
let(:user) { Fabricate(:user, confirmed_at: confirmed_at) }
|
||||
let(:app) { Fabricate(:application) }
|
||||
@@ -15,14 +15,14 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
end
|
||||
|
||||
context 'from a random app' do
|
||||
context 'when from a random app' do
|
||||
it 'returns http forbidden' do
|
||||
post :create
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
|
||||
context 'from an app that created the account' do
|
||||
context 'when from an app that created the account' do
|
||||
before do
|
||||
user.update(created_by_application: token.application)
|
||||
end
|
||||
@@ -35,7 +35,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
|
||||
context 'but user changed e-mail and has not confirmed it' do
|
||||
context 'with user changed e-mail and has not confirmed it' do
|
||||
before do
|
||||
user.update(email: 'foo@bar.com')
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::EndorsementsController, type: :controller do
|
||||
RSpec.describe Api::V1::EndorsementsController do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') }
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::FavouritesController, type: :controller do
|
||||
RSpec.describe Api::V1::FavouritesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::FiltersController, type: :controller do
|
||||
RSpec.describe Api::V1::FiltersController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::FollowRequestsController, type: :controller do
|
||||
RSpec.describe Api::V1::FollowRequestsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account_attributes: { locked: true }) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::FollowedTagsController, type: :controller do
|
||||
RSpec.describe Api::V1::FollowedTagsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Instances::ActivityController, type: :controller do
|
||||
RSpec.describe Api::V1::Instances::ActivityController do
|
||||
describe 'GET #show' do
|
||||
it 'returns 200' do
|
||||
get :show
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
context '!Setting.activity_api_enabled' do
|
||||
context 'with !Setting.activity_api_enabled' do
|
||||
it 'returns 404' do
|
||||
Setting.activity_api_enabled = false
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Instances::PeersController, type: :controller do
|
||||
RSpec.describe Api::V1::Instances::PeersController do
|
||||
describe 'GET #index' do
|
||||
it 'returns 200' do
|
||||
get :index
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
context '!Setting.peers_api_enabled' do
|
||||
context 'with !Setting.peers_api_enabled' do
|
||||
it 'returns 404' do
|
||||
Setting.peers_api_enabled = false
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::InstancesController, type: :controller do
|
||||
RSpec.describe Api::V1::InstancesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -29,17 +29,48 @@ describe Api::V1::Lists::AccountsController do
|
||||
let(:scopes) { 'write:lists' }
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(bob)
|
||||
post :create, params: { list_id: list.id, account_ids: [bob.id] }
|
||||
context 'when the added account is followed' do
|
||||
before do
|
||||
user.account.follow!(bob)
|
||||
post :create, params: { list_id: list.id, account_ids: [bob.id] }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'adds account to the list' do
|
||||
expect(list.accounts.include?(bob)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
context 'when the added account has been sent a follow request' do
|
||||
before do
|
||||
user.account.follow_requests.create!(target_account: bob)
|
||||
post :create, params: { list_id: list.id, account_ids: [bob.id] }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'adds account to the list' do
|
||||
expect(list.accounts.include?(bob)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
it 'adds account to the list' do
|
||||
expect(list.accounts.include?(bob)).to be true
|
||||
context 'when the added account is not followed' do
|
||||
before do
|
||||
post :create, params: { list_id: list.id, account_ids: [bob.id] }
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not add the account to the list' do
|
||||
expect(list.accounts.include?(bob)).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::ListsController, type: :controller do
|
||||
RSpec.describe Api::V1::ListsController do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::MarkersController, type: :controller do
|
||||
RSpec.describe Api::V1::MarkersController do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::MediaController, type: :controller do
|
||||
RSpec.describe Api::V1::MediaController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'image/jpeg' do
|
||||
context 'with image/jpeg' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
|
||||
end
|
||||
@@ -59,7 +59,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'image/gif' do
|
||||
context 'with image/gif' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.gif', 'image/gif') }
|
||||
end
|
||||
@@ -81,7 +81,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'video/webm' do
|
||||
context 'with video/webm' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.webm', 'video/webm') }
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::MutesController, type: :controller do
|
||||
RSpec.describe Api::V1::MutesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
@@ -13,13 +13,13 @@ RSpec.describe Api::V1::MutesController, type: :controller do
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'limits according to limit parameter' do
|
||||
2.times.map { Fabricate(:mute, account: user.account) }
|
||||
Array.new(2) { Fabricate(:mute, account: user.account) }
|
||||
get :index, params: { limit: 1 }
|
||||
expect(body_as_json.size).to eq 1
|
||||
end
|
||||
|
||||
it 'queries mutes in range according to max_id' do
|
||||
mutes = 2.times.map { Fabricate(:mute, account: user.account) }
|
||||
mutes = Array.new(2) { Fabricate(:mute, account: user.account) }
|
||||
|
||||
get :index, params: { max_id: mutes[1] }
|
||||
|
||||
@@ -28,7 +28,7 @@ RSpec.describe Api::V1::MutesController, type: :controller do
|
||||
end
|
||||
|
||||
it 'queries mutes in range according to since_id' do
|
||||
mutes = 2.times.map { Fabricate(:mute, account: user.account) }
|
||||
mutes = Array.new(2) { Fabricate(:mute, account: user.account) }
|
||||
|
||||
get :index, params: { since_id: mutes[0] }
|
||||
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Api::V1::MutesController, type: :controller do
|
||||
end
|
||||
|
||||
it 'sets pagination header for next path' do
|
||||
mutes = 2.times.map { Fabricate(:mute, account: user.account) }
|
||||
mutes = Array.new(2) { Fabricate(:mute, account: user.account) }
|
||||
get :index, params: { limit: 1, since_id: mutes[0] }
|
||||
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq api_v1_mutes_url(limit: 1, max_id: mutes[1])
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::NotificationsController, type: :controller do
|
||||
RSpec.describe Api::V1::NotificationsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account_attributes: { username: 'alice' }) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Polls::VotesController, type: :controller do
|
||||
RSpec.describe Api::V1::Polls::VotesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::PollsController, type: :controller do
|
||||
RSpec.describe Api::V1::PollsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::ReportsController, type: :controller do
|
||||
RSpec.describe Api::V1::ReportsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :controller do
|
||||
RSpec.describe Api::V1::Statuses::FavouritedByAccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controller do
|
||||
RSpec.describe Api::V1::Statuses::RebloggedByAccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::StatusesController, type: :controller do
|
||||
RSpec.describe Api::V1::StatusesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::SuggestionsController, type: :controller do
|
||||
RSpec.describe Api::V1::SuggestionsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::TagsController, type: :controller do
|
||||
RSpec.describe Api::V1::TagsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Trends::TagsController, type: :controller do
|
||||
RSpec.describe Api::V1::Trends::TagsController do
|
||||
render_views
|
||||
|
||||
describe 'GET #index' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V2::Admin::AccountsController, type: :controller do
|
||||
RSpec.describe Api::V2::Admin::AccountsController do
|
||||
render_views
|
||||
|
||||
let(:role) { UserRole.find_by(name: 'Moderator') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
|
||||
RSpec.describe Api::V2::Filters::KeywordsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
|
||||
RSpec.describe Api::V2::Filters::StatusesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V2::FiltersController, type: :controller do
|
||||
RSpec.describe Api::V2::FiltersController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
@@ -66,7 +66,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
|
||||
let!(:filter) { Fabricate(:custom_filter, account: user.account) }
|
||||
let!(:keyword) { Fabricate(:custom_filter_keyword, custom_filter: filter) }
|
||||
|
||||
context 'updating filter parameters' do
|
||||
context 'when updating filter parameters' do
|
||||
before do
|
||||
put :update, params: { id: filter.id, title: 'updated', context: %w(home public) }
|
||||
end
|
||||
@@ -84,7 +84,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'updating keywords in bulk' do
|
||||
context 'when updating keywords in bulk' do
|
||||
before do
|
||||
allow(redis).to receive_messages(publish: nil)
|
||||
put :update, params: { id: filter.id, keywords_attributes: [{ id: keyword.id, keyword: 'updated' }] }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V2::SearchController, type: :controller do
|
||||
RSpec.describe Api::V2::SearchController do
|
||||
render_views
|
||||
|
||||
context 'with token' do
|
||||
|
@@ -10,10 +10,10 @@ describe Api::Web::EmbedsController do
|
||||
before { sign_in user }
|
||||
|
||||
describe 'POST #create' do
|
||||
subject(:response) { post :create, params: { url: url } }
|
||||
|
||||
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
||||
|
||||
let(:response) { post :create, params: { url: url } }
|
||||
|
||||
context 'when successfully finds status' do
|
||||
let(:status) { Fabricate(:status) }
|
||||
let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
describe ApplicationController do
|
||||
controller do
|
||||
def success
|
||||
head 200
|
||||
@@ -32,7 +32,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'forgery' do
|
||||
context 'with a forgery' do
|
||||
subject do
|
||||
ActionController::Base.allow_forgery_protection = true
|
||||
routes.draw { post 'success' => 'anonymous#success' }
|
||||
@@ -112,7 +112,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'ActionController::RoutingError' do
|
||||
context 'with ActionController::RoutingError' do
|
||||
subject do
|
||||
routes.draw { get 'routing_error' => 'anonymous#routing_error' }
|
||||
get 'routing_error'
|
||||
@@ -121,7 +121,7 @@ describe ApplicationController, type: :controller do
|
||||
include_examples 'respond_with_error', 404
|
||||
end
|
||||
|
||||
context 'ActiveRecord::RecordNotFound' do
|
||||
context 'with ActiveRecord::RecordNotFound' do
|
||||
subject do
|
||||
routes.draw { get 'record_not_found' => 'anonymous#record_not_found' }
|
||||
get 'record_not_found'
|
||||
@@ -130,7 +130,7 @@ describe ApplicationController, type: :controller do
|
||||
include_examples 'respond_with_error', 404
|
||||
end
|
||||
|
||||
context 'ActionController::InvalidAuthenticityToken' do
|
||||
context 'with ActionController::InvalidAuthenticityToken' do
|
||||
subject do
|
||||
routes.draw { get 'invalid_authenticity_token' => 'anonymous#invalid_authenticity_token' }
|
||||
get 'invalid_authenticity_token'
|
||||
@@ -230,14 +230,16 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
|
||||
describe 'cache_collection' do
|
||||
class C < ApplicationController
|
||||
public :cache_collection
|
||||
subject do
|
||||
Class.new(ApplicationController) do
|
||||
public :cache_collection
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'receives :with_includes' do |fabricator, klass|
|
||||
it 'uses raw if it is not an ActiveRecord::Relation' do
|
||||
record = Fabricate(fabricator)
|
||||
expect(C.new.cache_collection([record], klass)).to eq [record]
|
||||
expect(subject.new.cache_collection([record], klass)).to eq [record]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -248,16 +250,16 @@ describe ApplicationController, type: :controller do
|
||||
record = Fabricate(fabricator)
|
||||
relation = klass.none
|
||||
allow(relation).to receive(:cache_ids).and_return([record])
|
||||
expect(C.new.cache_collection(relation, klass)).to eq [record]
|
||||
expect(subject.new.cache_collection(relation, klass)).to eq [record]
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns raw unless class responds to :with_includes' do
|
||||
raw = Object.new
|
||||
expect(C.new.cache_collection(raw, Object)).to eq raw
|
||||
expect(subject.new.cache_collection(raw, Object)).to eq raw
|
||||
end
|
||||
|
||||
context 'Status' do
|
||||
context 'with a Status' do
|
||||
include_examples 'cacheable', :status, Status
|
||||
end
|
||||
end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Auth::ChallengesController, type: :controller do
|
||||
describe Auth::ChallengesController do
|
||||
render_views
|
||||
|
||||
let(:password) { 'foobar12345' }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Auth::ConfirmationsController, type: :controller do
|
||||
describe Auth::ConfirmationsController do
|
||||
render_views
|
||||
|
||||
describe 'GET #new' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Auth::PasswordsController, type: :controller do
|
||||
describe Auth::PasswordsController do
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
describe 'GET #new' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
RSpec.describe Auth::RegistrationsController do
|
||||
render_views
|
||||
|
||||
shared_examples 'checks for enabled registrations' do |path|
|
||||
@@ -157,7 +157,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations without invite' do
|
||||
context 'with Approval-based registrations without invite' do
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
@@ -184,7 +184,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations with expired invite' do
|
||||
context 'with Approval-based registrations with expired invite' do
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
@@ -212,7 +212,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations with valid invite and required invite text' do
|
||||
context 'with Approval-based registrations with valid invite and required invite text' do
|
||||
subject do
|
||||
inviter = Fabricate(:user, confirmed_at: 2.days.ago)
|
||||
Setting.registrations_mode = 'approved'
|
||||
|
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
require 'webauthn/fake_client'
|
||||
|
||||
RSpec.describe Auth::SessionsController, type: :controller do
|
||||
RSpec.describe Auth::SessionsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
@@ -51,8 +51,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
|
||||
context 'using a valid password' do
|
||||
context 'when using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
|
||||
context 'when using a valid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: 'pam_user1', password: '123456' } }
|
||||
end
|
||||
@@ -66,7 +66,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using an invalid password' do
|
||||
context 'when using an invalid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: 'pam_user1', password: 'WRONGPW' } }
|
||||
end
|
||||
@@ -80,7 +80,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using a valid email and existing user' do
|
||||
context 'when using a valid email and existing user' do
|
||||
let!(:user) do
|
||||
account = Fabricate.build(:account, username: 'pam_user1', user: nil)
|
||||
account.save!(validate: false)
|
||||
@@ -102,10 +102,10 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using password authentication' do
|
||||
context 'when using password authentication' do
|
||||
let(:user) { Fabricate(:user, email: 'foo@bar.com', password: 'abcdefgh') }
|
||||
|
||||
context 'using a valid password' do
|
||||
context 'when using a valid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
@@ -119,7 +119,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using a valid password on a previously-used account with a new IP address' do
|
||||
context 'when using a valid password on a previously-used account with a new IP address' do
|
||||
let(:previous_ip) { '1.2.3.4' }
|
||||
let(:current_ip) { '4.3.2.1' }
|
||||
|
||||
@@ -145,7 +145,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using email with uppercase letters' do
|
||||
context 'when using email with uppercase letters' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
@@ -159,7 +159,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using an invalid password' do
|
||||
context 'when using an invalid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: 'wrongpw' } }
|
||||
end
|
||||
@@ -173,7 +173,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using an unconfirmed password' do
|
||||
context 'when using an unconfirmed password' do
|
||||
before do
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
post :create, params: { user: { email: unconfirmed_user.email, password: unconfirmed_user.password } }
|
||||
@@ -187,14 +187,14 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context "logging in from the user's page" do
|
||||
context "when logging in from the user's page" do
|
||||
before do
|
||||
allow(controller).to receive(:single_user_mode?).and_return(single_user_mode)
|
||||
allow(controller).to receive(:stored_location_for).with(:user).and_return("/@#{user.account.username}")
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
||||
context 'in single user mode' do
|
||||
context 'with single user mode' do
|
||||
let(:single_user_mode) { true }
|
||||
|
||||
it 'redirects to home' do
|
||||
@@ -202,7 +202,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'in non-single user mode' do
|
||||
context 'with non-single user mode' do
|
||||
let(:single_user_mode) { false }
|
||||
|
||||
it "redirects back to the user's page" do
|
||||
@@ -212,7 +212,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using two-factor authentication' do
|
||||
context 'when using two-factor authentication' do
|
||||
context 'with OTP enabled as second factor' do
|
||||
let!(:user) do
|
||||
Fabricate(:user, email: 'x@y.com', password: 'abcdefgh', otp_required_for_login: true, otp_secret: User.generate_otp_secret(32))
|
||||
@@ -224,7 +224,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
return codes
|
||||
end
|
||||
|
||||
context 'using email and password' do
|
||||
context 'when using email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
@@ -235,7 +235,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using email and password after an unfinished log-in attempt to a 2FA-protected account' do
|
||||
context 'when using email and password after an unfinished log-in attempt to a 2FA-protected account' do
|
||||
let!(:other_user) do
|
||||
Fabricate(:user, email: 'z@y.com', password: 'abcdefgh', otp_required_for_login: true, otp_secret: User.generate_otp_secret(32))
|
||||
end
|
||||
@@ -251,7 +251,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using upcase email and password' do
|
||||
context 'when using upcase email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
@@ -262,7 +262,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using a valid OTP' do
|
||||
context 'when using a valid OTP' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
@@ -291,7 +291,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using a valid recovery code' do
|
||||
context 'when using a valid recovery code' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: recovery_codes.first } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
@@ -305,7 +305,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using an invalid OTP' do
|
||||
context 'when using an invalid OTP' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: 'wrongotp' } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
@@ -353,7 +353,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
|
||||
let(:fake_credential) { fake_client.get(challenge: challenge, sign_count: sign_count) }
|
||||
|
||||
context 'using email and password' do
|
||||
context 'when using email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
@@ -364,7 +364,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using upcase email and password' do
|
||||
context 'when using upcase email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
@@ -375,7 +375,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'using a valid webauthn credential' do
|
||||
context 'when using a valid webauthn credential' do
|
||||
before do
|
||||
@controller.session[:webauthn_challenge] = challenge
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
describe ApplicationController do
|
||||
controller do
|
||||
include AccountControllerConcern
|
||||
|
||||
|
@@ -3,18 +3,20 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountableConcern do
|
||||
class Hoge
|
||||
include AccountableConcern
|
||||
attr_reader :current_account
|
||||
let(:hoge_class) do
|
||||
Class.new do
|
||||
include AccountableConcern
|
||||
attr_reader :current_account
|
||||
|
||||
def initialize(current_account)
|
||||
@current_account = current_account
|
||||
def initialize(current_account)
|
||||
@current_account = current_account
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
let(:user) { Fabricate(:account) }
|
||||
let(:target) { Fabricate(:account) }
|
||||
let(:hoge) { Hoge.new(user) }
|
||||
let(:hoge) { hoge_class.new(user) }
|
||||
|
||||
describe '#log_action' do
|
||||
it 'creates Admin::ActionLog' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CacheConcern, type: :controller do
|
||||
RSpec.describe CacheConcern do
|
||||
controller(ApplicationController) do
|
||||
include CacheConcern
|
||||
|
||||
@@ -23,14 +23,14 @@ RSpec.describe CacheConcern, type: :controller do
|
||||
end
|
||||
|
||||
describe '#cache_collection' do
|
||||
context 'given an empty array' do
|
||||
context 'when given an empty array' do
|
||||
it 'returns an empty array' do
|
||||
get :empty_array
|
||||
expect(response.body).to eq '0'
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an empty relation' do
|
||||
context 'when given an empty relation' do
|
||||
it 'returns an empty array' do
|
||||
get :empty_relation
|
||||
expect(response.body).to eq '0'
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ChallengableConcern, type: :controller do
|
||||
RSpec.describe ChallengableConcern do
|
||||
controller(ApplicationController) do
|
||||
include ChallengableConcern
|
||||
|
||||
@@ -31,7 +31,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo }
|
||||
|
||||
it 'does not ask for password' do
|
||||
@@ -39,7 +39,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar }
|
||||
|
||||
it 'does not ask for password' do
|
||||
@@ -56,7 +56,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo, session: { challenge_passed_at: Time.now.utc } }
|
||||
|
||||
it 'does not ask for password' do
|
||||
@@ -64,7 +64,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar, session: { challenge_passed_at: Time.now.utc } }
|
||||
|
||||
it 'does not ask for password' do
|
||||
@@ -81,7 +81,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo }
|
||||
|
||||
it 'renders challenge' do
|
||||
@@ -91,7 +91,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
||||
# See Auth::ChallengesControllerSpec
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar }
|
||||
|
||||
it 'renders challenge' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
describe ApplicationController do
|
||||
controller do
|
||||
include ExportControllerConcern
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
describe ApplicationController do
|
||||
controller do
|
||||
include Localized
|
||||
|
||||
@@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'user with valid locale has signed in' do
|
||||
context 'with a user with valid locale has signed in' do
|
||||
it "sets user's locale" do
|
||||
user = Fabricate(:user, locale: :ca)
|
||||
|
||||
@@ -52,7 +52,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context 'user with invalid locale has signed in' do
|
||||
context 'with a user with invalid locale has signed in' do
|
||||
before do
|
||||
user = Fabricate.build(:user, locale: :invalid)
|
||||
user.save!(validate: false)
|
||||
@@ -62,7 +62,7 @@ describe ApplicationController, type: :controller do
|
||||
include_examples 'default locale'
|
||||
end
|
||||
|
||||
context 'user has not signed in' do
|
||||
context 'with a user who has not signed in' do
|
||||
include_examples 'default locale'
|
||||
end
|
||||
end
|
||||
|
@@ -16,7 +16,7 @@ describe ApplicationController do
|
||||
end
|
||||
|
||||
describe 'rate limiting' do
|
||||
context 'throttling is off' do
|
||||
context 'when throttling is off' do
|
||||
before do
|
||||
request.env['rack.attack.throttle_data'] = nil
|
||||
end
|
||||
@@ -30,7 +30,7 @@ describe ApplicationController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'throttling is on' do
|
||||
context 'when throttling is on' do
|
||||
let(:start_time) { DateTime.new(2017, 1, 1, 12, 0, 0).utc }
|
||||
|
||||
before do
|
||||
|
@@ -2,15 +2,17 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
class WrappedActor
|
||||
attr_reader :wrapped_account
|
||||
describe ApplicationController do
|
||||
let(:wrapped_actor_class) do
|
||||
Class.new do
|
||||
attr_reader :wrapped_account
|
||||
|
||||
def initialize(wrapped_account)
|
||||
@wrapped_account = wrapped_account
|
||||
def initialize(wrapped_account)
|
||||
@wrapped_account = wrapped_account
|
||||
end
|
||||
|
||||
delegate :uri, :keypair, to: :wrapped_account
|
||||
end
|
||||
|
||||
delegate :uri, :keypair, to: :wrapped_account
|
||||
end
|
||||
|
||||
controller do
|
||||
@@ -33,8 +35,8 @@ describe ApplicationController, type: :controller do
|
||||
|
||||
before do
|
||||
routes.draw do
|
||||
match via: [:get, :post], 'success' => 'anonymous#success'
|
||||
match via: [:get, :post], 'signature_required' => 'anonymous#signature_required'
|
||||
match :via => [:get, :post], 'success' => 'anonymous#success'
|
||||
match :via => [:get, :post], 'signature_required' => 'anonymous#signature_required'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +95,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
|
||||
context 'with a valid actor that is not an Account' do
|
||||
let(:actor) { WrappedActor.new(author) }
|
||||
let(:actor) { wrapped_actor_class.new(author) }
|
||||
|
||||
before do
|
||||
get :success
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ApplicationController, type: :controller do
|
||||
describe ApplicationController do
|
||||
controller do
|
||||
include UserTrackingConcern
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Disputes::AppealsController, type: :controller do
|
||||
RSpec.describe Disputes::AppealsController do
|
||||
render_views
|
||||
|
||||
before { sign_in current_user, scope: :user }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Disputes::StrikesController, type: :controller do
|
||||
RSpec.describe Disputes::StrikesController do
|
||||
render_views
|
||||
|
||||
before { sign_in current_user, scope: :user }
|
||||
|
@@ -8,10 +8,10 @@ describe EmojisController do
|
||||
let(:emoji) { Fabricate(:custom_emoji) }
|
||||
|
||||
describe 'GET #show' do
|
||||
subject(:response) { get :show, params: { id: emoji.id, format: :json } }
|
||||
|
||||
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
||||
|
||||
let(:response) { get :show, params: { id: emoji.id, format: :json } }
|
||||
|
||||
it 'returns the right response' do
|
||||
expect(response).to have_http_status 200
|
||||
expect(body[:name]).to eq ':coolcat:'
|
||||
|
@@ -39,10 +39,10 @@ describe FollowerAccountsController do
|
||||
end
|
||||
|
||||
context 'when format is json' do
|
||||
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||
|
||||
subject(:body) { response.parsed_body }
|
||||
|
||||
let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||
|
||||
context 'with page' do
|
||||
let(:page) { 1 }
|
||||
|
||||
|
@@ -39,10 +39,10 @@ describe FollowingAccountsController do
|
||||
end
|
||||
|
||||
context 'when format is json' do
|
||||
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||
|
||||
subject(:body) { response.parsed_body }
|
||||
|
||||
let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||
|
||||
context 'with page' do
|
||||
let(:page) { 1 }
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe HomeController, type: :controller do
|
||||
RSpec.describe HomeController do
|
||||
render_views
|
||||
|
||||
describe 'GET #index' do
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe InstanceActorsController, type: :controller do
|
||||
RSpec.describe InstanceActorsController do
|
||||
describe 'GET #show' do
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
shared_examples 'shared behavior' do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe IntentsController, type: :controller do
|
||||
RSpec.describe IntentsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Oauth::AuthorizationsController, type: :controller do
|
||||
RSpec.describe Oauth::AuthorizationsController do
|
||||
render_views
|
||||
|
||||
let(:app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/', scopes: 'read') }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Oauth::TokensController, type: :controller do
|
||||
RSpec.describe Oauth::TokensController do
|
||||
describe 'POST #revoke' do
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let!(:application) { Fabricate(:application, confidential: false) }
|
||||
|
@@ -50,7 +50,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'success (passed scopes as a String)' do
|
||||
context 'when success (passed scopes as a String)' do
|
||||
def call_create
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
@@ -72,7 +72,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'success (passed scopes as an Array)' do
|
||||
context 'when success (passed scopes as an Array)' do
|
||||
def call_create
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
@@ -94,7 +94,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'failure' do
|
||||
context 'with failure request' do
|
||||
before do
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
@@ -117,7 +117,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
context 'success' do
|
||||
context 'when success' do
|
||||
let(:opts) do
|
||||
{
|
||||
website: 'https://foo.bar/',
|
||||
@@ -142,7 +142,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'failure' do
|
||||
context 'with failure request' do
|
||||
before do
|
||||
patch :update, params: {
|
||||
id: app.id,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user