Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.github/dependabot.yml`: Upstream made changes while we have dropped this file. Keep the file deleted. - `.prettierignore`: Upstream made changes at the end of the file, where we had our extra lines. Just moved our extra lines back at the end. - `app/serializers/initial_state_serializer.rb`: Upstream code style changes. Applied them. - `app/services/backup_service.rb`: Upstream code style changes. Applied them.
This commit is contained in:
@@ -8,7 +8,7 @@ RSpec.describe AccountsController, type: :controller do
|
||||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
||||
@@ -10,7 +10,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
||||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
||||
@@ -6,7 +6,7 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
|
||||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
||||
@@ -11,7 +11,7 @@ RSpec.describe ActivityPub::RepliesController, type: :controller do
|
||||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
||||
@@ -39,7 +39,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
||||
username: 'username',
|
||||
display_name: 'display name',
|
||||
email: 'local-part@domain',
|
||||
ip: '0.0.0.42'
|
||||
ip: '0.0.0.42',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
user = Fabricate(:user)
|
||||
|
||||
get :show, params: { account_id: user.account.id }
|
||||
@@ -19,12 +19,12 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #update" do
|
||||
describe 'GET #update' do
|
||||
before do
|
||||
allow(UserMailer).to receive(:confirmation_instructions).and_return(double('email', deliver_later: nil))
|
||||
end
|
||||
|
||||
it "returns http success" do
|
||||
it 'returns http success' do
|
||||
user = Fabricate(:user)
|
||||
|
||||
previous_email = user.email
|
||||
|
||||
@@ -8,10 +8,10 @@ describe Admin::DashboardController, type: :controller do
|
||||
describe 'GET #index' do
|
||||
before do
|
||||
allow(Admin::SystemCheck).to receive(:perform).and_return([
|
||||
Admin::SystemCheck::Message.new(:database_schema_check),
|
||||
Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
|
||||
Admin::SystemCheck::Message.new(:sidekiq_process_check, 'foo, bar'),
|
||||
])
|
||||
Admin::SystemCheck::Message.new(:database_schema_check),
|
||||
Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
|
||||
Admin::SystemCheck::Message.new(:sidekiq_process_check, 'foo, bar'),
|
||||
])
|
||||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin'))
|
||||
end
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
|
||||
domain_blocks_attributes: {
|
||||
'0' => { enabled: '1', domain: 'example.com', severity: 'silence' },
|
||||
'1' => { enabled: '0', domain: 'mastodon.social', severity: 'suspend' },
|
||||
'2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' }
|
||||
}
|
||||
}
|
||||
'2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expect(DomainBlockWorker).to have_received(:perform_async).exactly(2).times
|
||||
|
||||
@@ -4,6 +4,7 @@ describe Admin::ReportsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ describe Admin::ResetsController do
|
||||
render_views
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ describe Api::V1::Accounts::CredentialsController do
|
||||
source: {
|
||||
privacy: 'unlisted',
|
||||
sensitive: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ describe Api::V1::Accounts::CredentialsController do
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with invalid data' do
|
||||
before do
|
||||
|
||||
@@ -65,7 +65,7 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do
|
||||
it "returns the correct accounts (#{expected_results.inspect})" do
|
||||
json = body_as_json
|
||||
|
||||
expect(json.map { |a| a[:id].to_i }).to eq (expected_results.map { |symbol| send(symbol).id })
|
||||
expect(json.map { |a| a[:id].to_i }).to eq(expected_results.map { |symbol| send(symbol).id })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ RSpec.describe Api::V1::AppsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'creates an OAuth app' do
|
||||
expect(Doorkeeper::Application.find_by(name: client_name)).to_not be nil
|
||||
expect(Doorkeeper::Application.find_by(name: client_name)).to_not be_nil
|
||||
end
|
||||
|
||||
it 'returns client ID and client secret' do
|
||||
|
||||
@@ -42,7 +42,7 @@ RSpec.describe Api::V1::MarkersController, type: :controller do
|
||||
|
||||
it 'creates a marker' do
|
||||
expect(user.markers.first.timeline).to eq 'home'
|
||||
expect(user.markers.first.last_read_id).to eq 69420
|
||||
expect(user.markers.first.last_read_id).to eq 69_420
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ RSpec.describe Api::V1::MarkersController, type: :controller do
|
||||
|
||||
it 'updates a marker' do
|
||||
expect(user.markers.first.timeline).to eq 'home'
|
||||
expect(user.markers.first.last_read_id).to eq 70120
|
||||
expect(user.markers.first.last_read_id).to eq 70_120
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ describe Api::V1::Push::SubscriptionsController do
|
||||
p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=',
|
||||
auth: 'eH_C8rq2raXqlcBVDa1gLg==',
|
||||
},
|
||||
}
|
||||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
@@ -37,8 +37,8 @@ describe Api::V1::Push::SubscriptionsController do
|
||||
mention: false,
|
||||
poll: true,
|
||||
status: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
|
||||
let(:target_account) { status.account }
|
||||
let(:category) { nil }
|
||||
let(:forward) { nil }
|
||||
let(:rule_ids){ nil }
|
||||
let(:rule_ids) { nil }
|
||||
|
||||
before do
|
||||
allow(AdminMailer).to receive(:new_report).and_return(double('email', deliver_later: nil))
|
||||
|
||||
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
|
||||
it 'returns accounts who favorited the status' do
|
||||
get :index, params: { status_id: status.id, limit: 2 }
|
||||
expect(body_as_json.size).to eq 2
|
||||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
|
||||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
|
||||
end
|
||||
|
||||
it 'does not return blocked users' do
|
||||
|
||||
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
|
||||
it 'returns accounts who reblogged the status' do
|
||||
get :index, params: { status_id: status.id, limit: 2 }
|
||||
expect(body_as_json.size).to eq 2
|
||||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
|
||||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
|
||||
end
|
||||
|
||||
it 'does not return blocked users' do
|
||||
|
||||
@@ -195,7 +195,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
|
||||
end
|
||||
|
||||
it 'removes the status' do
|
||||
expect(Status.find_by(id: status.id)).to be nil
|
||||
expect(Status.find_by(id: status.id)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ describe Api::V1::StreamingController do
|
||||
[:scheme, :path, :query, :fragment].each do |part|
|
||||
expect(redirect_to_uri.send(part)).to eq(request_uri.send(part)), "redirect target #{part}"
|
||||
end
|
||||
expect(redirect_to_uri.host).to eq(@streaming_host), "redirect target host"
|
||||
expect(redirect_to_uri.host).to eq(@streaming_host), 'redirect target host'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ RSpec.describe Api::V1::SuggestionsController, type: :controller do
|
||||
json = body_as_json
|
||||
|
||||
expect(json.size).to be >= 1
|
||||
expect(json.map { |i| i[:id] }).to include *[bob, jeff].map { |i| i.id.to_s }
|
||||
expect(json.map { |i| i[:id] }).to include(*[bob, jeff].map { |i| i.id.to_s })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ RSpec.describe Api::V2::Admin::AccountsController, type: :controller do
|
||||
it "returns the correct accounts (#{expected_results.inspect})" do
|
||||
json = body_as_json
|
||||
|
||||
expect(json.map { |a| a[:id].to_i }).to eq (expected_results.map { |symbol| send(symbol).id })
|
||||
expect(json.map { |a| a[:id].to_i }).to eq(expected_results.map { |symbol| send(symbol).id })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
let(:scopes) { 'read:filters' }
|
||||
let(:scopes) { 'read:filters' }
|
||||
let!(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
|
||||
|
||||
before do
|
||||
@@ -90,7 +90,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:scopes) { 'write:filters' }
|
||||
let(:scopes) { 'write:filters' }
|
||||
let(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
|
||||
|
||||
before do
|
||||
|
||||
@@ -6,6 +6,7 @@ describe Api::Web::EmbedsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'POST #create' do
|
||||
|
||||
@@ -15,7 +15,7 @@ describe Api::Web::PushSubscriptionsController do
|
||||
p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=',
|
||||
auth: 'eH_C8rq2raXqlcBVDa1gLg==',
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -32,8 +32,8 @@ describe Api::Web::PushSubscriptionsController do
|
||||
mention: false,
|
||||
poll: true,
|
||||
status: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ describe ApplicationController, type: :controller do
|
||||
expect(response).to have_http_status(code)
|
||||
end
|
||||
|
||||
it "renders template for http" do
|
||||
it 'renders template for http' do
|
||||
is_expected.to render_template("errors/#{code}", layout: 'error')
|
||||
end
|
||||
end
|
||||
@@ -150,7 +150,7 @@ describe ApplicationController, type: :controller do
|
||||
end
|
||||
|
||||
it 'does not store location for user if it is devise controller' do
|
||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
@request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
get 'create'
|
||||
expect(controller.stored_location_for(:user)).to be_nil
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
describe 'GET #edit' do
|
||||
it 'returns http success' do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
sign_in(Fabricate(:user))
|
||||
get :edit
|
||||
expect(response).to have_http_status(200)
|
||||
@@ -41,7 +41,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
describe 'GET #update' do
|
||||
it 'returns http success' do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
sign_in(Fabricate(:user), scope: :user)
|
||||
post :update
|
||||
expect(response).to have_http_status(200)
|
||||
@@ -49,7 +49,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
context 'when suspended' do
|
||||
it 'returns http forbidden' do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
sign_in(Fabricate(:user, account_attributes: { username: 'test', suspended_at: Time.now.utc }), scope: :user)
|
||||
post :update
|
||||
expect(response).to have_http_status(403)
|
||||
@@ -59,7 +59,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
describe 'GET #new' do
|
||||
before do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
end
|
||||
|
||||
context do
|
||||
@@ -92,7 +92,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
I18n.locale = current_locale
|
||||
end
|
||||
|
||||
before { request.env["devise.mapping"] = Devise.mappings[:user] }
|
||||
before { request.env['devise.mapping'] = Devise.mappings[:user] }
|
||||
|
||||
context do
|
||||
around do |example|
|
||||
@@ -103,7 +103,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
subject do
|
||||
Setting.registrations_mode = 'open'
|
||||
request.headers["Accept-Language"] = accept_language
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
|
||||
end
|
||||
|
||||
@@ -129,7 +129,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
subject do
|
||||
Setting.registrations_mode = 'open'
|
||||
request.headers["Accept-Language"] = accept_language
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'false' } }
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers["Accept-Language"] = accept_language
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
|
||||
end
|
||||
|
||||
@@ -176,9 +176,9 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers["Accept-Language"] = accept_language
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago)
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } }
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
|
||||
end
|
||||
|
||||
it 'redirects to setup' do
|
||||
@@ -208,9 +208,9 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
||||
inviter = Fabricate(:user, confirmed_at: 2.days.ago)
|
||||
Setting.registrations_mode = 'approved'
|
||||
Setting.require_invite_text = true
|
||||
request.headers["Accept-Language"] = accept_language
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now)
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } }
|
||||
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
|
||||
end
|
||||
|
||||
it 'redirects to setup' do
|
||||
|
||||
@@ -54,7 +54,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
|
||||
context 'using a valid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: "pam_user1", password: '123456' } }
|
||||
post :create, params: { user: { email: 'pam_user1', password: '123456' } }
|
||||
end
|
||||
|
||||
it 'redirects to home' do
|
||||
@@ -68,7 +68,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
|
||||
context 'using an invalid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: "pam_user1", password: 'WRONGPW' } }
|
||||
post :create, params: { user: { email: 'pam_user1', password: 'WRONGPW' } }
|
||||
end
|
||||
|
||||
it 'shows a login error' do
|
||||
@@ -127,7 +127,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
|
||||
before do
|
||||
allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip).and_return(current_ip)
|
||||
allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', 'deliver_later!': nil))
|
||||
allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', deliver_later!: nil))
|
||||
user.update(current_sign_in_at: 1.month.ago)
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
@@ -194,7 +194,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
||||
context "in single user mode" do
|
||||
context 'in 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 'in non-single user mode' do
|
||||
let(:single_user_mode) { false }
|
||||
|
||||
it "redirects back to the user's page" do
|
||||
@@ -230,8 +230,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'renders two factor authentication page' do
|
||||
expect(controller).to render_template("two_factor")
|
||||
expect(controller).to render_template(partial: "_otp_authentication_form")
|
||||
expect(controller).to render_template('two_factor')
|
||||
expect(controller).to render_template(partial: '_otp_authentication_form')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -246,8 +246,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'renders two factor authentication page' do
|
||||
expect(controller).to render_template("two_factor")
|
||||
expect(controller).to render_template(partial: "_otp_authentication_form")
|
||||
expect(controller).to render_template('two_factor')
|
||||
expect(controller).to render_template(partial: '_otp_authentication_form')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -257,8 +257,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'renders two factor authentication page' do
|
||||
expect(controller).to render_template("two_factor")
|
||||
expect(controller).to render_template(partial: "_otp_authentication_form")
|
||||
expect(controller).to render_template('two_factor')
|
||||
expect(controller).to render_template(partial: '_otp_authentication_form')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -339,11 +339,11 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
external_id: public_key_credential.id,
|
||||
public_key: public_key_credential.public_key,
|
||||
sign_count: '1000'
|
||||
)
|
||||
)
|
||||
user.webauthn_credentials.take
|
||||
end
|
||||
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
|
||||
|
||||
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
|
||||
|
||||
@@ -359,8 +359,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'renders webauthn authentication page' do
|
||||
expect(controller).to render_template("two_factor")
|
||||
expect(controller).to render_template(partial: "_webauthn_form")
|
||||
expect(controller).to render_template('two_factor')
|
||||
expect(controller).to render_template(partial: '_webauthn_form')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -370,8 +370,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'renders webauthn authentication page' do
|
||||
expect(controller).to render_template("two_factor")
|
||||
expect(controller).to render_template(partial: "_webauthn_form")
|
||||
expect(controller).to render_template('two_factor')
|
||||
expect(controller).to render_template(partial: '_webauthn_form')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -400,7 +400,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
||||
|
||||
describe 'GET #webauthn_options' do
|
||||
context 'with WebAuthn and OTP enabled as second factor' do
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
|
||||
|
||||
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ describe AuthorizeInteractionsController do
|
||||
allow(ResolveAccountService).to receive(:new).and_return(service)
|
||||
allow(service).to receive(:call).with('user@hostname').and_return(target_account)
|
||||
|
||||
|
||||
post :create, params: { acct: 'acct:user@hostname' }
|
||||
|
||||
expect(account.following?(target_account)).to be true
|
||||
|
||||
@@ -20,7 +20,7 @@ RSpec.describe InstanceActorsController, type: :controller do
|
||||
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
@@ -43,11 +43,13 @@ RSpec.describe InstanceActorsController, type: :controller do
|
||||
|
||||
context 'without authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { false }
|
||||
|
||||
it_behaves_like 'shared behavior'
|
||||
end
|
||||
|
||||
context 'with authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { true }
|
||||
|
||||
it_behaves_like 'shared behavior'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ RSpec.describe IntentsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user, scope: :user }
|
||||
|
||||
describe 'GET #show' do
|
||||
|
||||
@@ -13,7 +13,7 @@ describe Oauth::AuthorizedApplicationsController do
|
||||
shared_examples 'stores location for user' do
|
||||
it 'stores location for user' do
|
||||
subject
|
||||
expect(controller.stored_location_for(:user)).to eq "/oauth/authorized_applications"
|
||||
expect(controller.stored_location_for(:user)).to eq '/oauth/authorized_applications'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ describe Settings::ApplicationsController do
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
it 'works' do
|
||||
it 'returns http success' do
|
||||
get :new
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
@@ -51,8 +51,8 @@ describe Settings::ApplicationsController do
|
||||
name: 'My New App',
|
||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||
website: 'http://google.com',
|
||||
scopes: 'read write follow'
|
||||
}
|
||||
scopes: 'read write follow',
|
||||
},
|
||||
}
|
||||
response
|
||||
end
|
||||
@@ -73,8 +73,8 @@ describe Settings::ApplicationsController do
|
||||
name: 'My New App',
|
||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||
website: 'http://google.com',
|
||||
scopes: [ 'read', 'write', 'follow' ]
|
||||
}
|
||||
scopes: ['read', 'write', 'follow'],
|
||||
},
|
||||
}
|
||||
response
|
||||
end
|
||||
@@ -95,8 +95,8 @@ describe Settings::ApplicationsController do
|
||||
name: '',
|
||||
redirect_uri: '',
|
||||
website: '',
|
||||
scopes: []
|
||||
}
|
||||
scopes: [],
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -112,16 +112,16 @@ describe Settings::ApplicationsController do
|
||||
|
||||
describe 'PATCH #update' do
|
||||
context 'success' do
|
||||
let(:opts) {
|
||||
let(:opts) do
|
||||
{
|
||||
website: 'https://foo.bar/'
|
||||
website: 'https://foo.bar/',
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def call_update
|
||||
patch :update, params: {
|
||||
id: app.id,
|
||||
doorkeeper_application: opts
|
||||
doorkeeper_application: opts,
|
||||
}
|
||||
response
|
||||
end
|
||||
@@ -144,8 +144,8 @@ describe Settings::ApplicationsController do
|
||||
name: '',
|
||||
redirect_uri: '',
|
||||
website: '',
|
||||
scopes: []
|
||||
}
|
||||
scopes: [],
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -175,12 +175,13 @@ describe Settings::ApplicationsController do
|
||||
|
||||
describe 'regenerate' do
|
||||
let(:token) { user.token_for_app(app) }
|
||||
|
||||
before do
|
||||
expect(token).to_not be_nil
|
||||
post :regenerate, params: { id: app.id }
|
||||
end
|
||||
|
||||
it 'should create new token' do
|
||||
it 'creates new token' do
|
||||
expect(user.token_for_app(app)).to_not eql(token)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,8 +7,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
|
||||
sign_in Fabricate(:user), scope: :user
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
@@ -21,8 +21,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
|
||||
post :create, params: {
|
||||
import: {
|
||||
type: 'following',
|
||||
data: fixture_file_upload('imports.txt')
|
||||
}
|
||||
data: fixture_file_upload('imports.txt'),
|
||||
},
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(settings_import_path)
|
||||
@@ -34,8 +34,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
|
||||
post :create, params: {
|
||||
import: {
|
||||
type: 'blocking',
|
||||
data: fixture_file_upload('imports.txt')
|
||||
}
|
||||
data: fixture_file_upload('imports.txt'),
|
||||
},
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(settings_import_path)
|
||||
|
||||
@@ -90,7 +90,7 @@ describe Settings::MigrationsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a recent migration already exists ' do
|
||||
context 'when a recent migration already exists' do
|
||||
let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) }
|
||||
|
||||
before do
|
||||
|
||||
@@ -25,7 +25,7 @@ describe Settings::Preferences::NotificationsController do
|
||||
user: {
|
||||
notification_emails: { follow: '1' },
|
||||
interactions: { must_be_follower: '0' },
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(settings_preferences_notifications_path)
|
||||
|
||||
@@ -34,7 +34,7 @@ describe Settings::Preferences::OtherController do
|
||||
user: {
|
||||
setting_boost_modal: '1',
|
||||
setting_delete_modal: '0',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(settings_preferences_other_path)
|
||||
|
||||
@@ -10,8 +10,8 @@ RSpec.describe Settings::ProfilesController, type: :controller do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ describe Settings::SessionsController do
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:session_activation) { Fabricate(:session_activation, user: user) }
|
||||
|
||||
before { sign_in user, scope: :user }
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
|
||||
@@ -5,7 +5,6 @@ require 'rails_helper'
|
||||
describe Settings::TwoFactorAuthentication::ConfirmationsController do
|
||||
render_views
|
||||
|
||||
|
||||
shared_examples 'renders :new' do
|
||||
it 'renders the new view' do
|
||||
subject
|
||||
|
||||
@@ -7,7 +7,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
|
||||
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
|
||||
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
|
||||
|
||||
def add_webauthn_credential(user)
|
||||
@@ -137,7 +137,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
|
||||
expect { get :options }.to_not change { user.webauthn_id }
|
||||
end
|
||||
|
||||
it "includes existing credentials in list of excluded credentials" do
|
||||
it 'includes existing credentials in list of excluded credentials' do
|
||||
get :options
|
||||
|
||||
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].map { |credential| credential['id'] }
|
||||
|
||||
@@ -4,6 +4,7 @@ describe SharesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'GTE #show' do
|
||||
|
||||
@@ -8,8 +8,8 @@ RSpec.describe StatusesCleanupController, type: :controller do
|
||||
sign_in @user, scope: :user
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ describe StatusesController do
|
||||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
||||
@@ -9,12 +9,12 @@ describe WellKnown::HostMetaController, type: :controller do
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.media_type).to eq 'application/xrd+xml'
|
||||
expect(response.body).to eq <<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Link rel="lrdd" template="https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}"/>
|
||||
</XRD>
|
||||
XML
|
||||
expect(response.body).to eq <<~XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Link rel="lrdd" template="https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}"/>
|
||||
</XRD>
|
||||
XML
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,8 +27,8 @@ describe WellKnown::NodeInfoController, type: :controller do
|
||||
|
||||
json = body_as_json
|
||||
|
||||
expect({ "foo" => 0 }).not_to match_json_schema("nodeinfo_2.0")
|
||||
expect(json).to match_json_schema("nodeinfo_2.0")
|
||||
expect({ 'foo' => 0 }).not_to match_json_schema('nodeinfo_2.0')
|
||||
expect(json).to match_json_schema('nodeinfo_2.0')
|
||||
expect(json[:version]).to eq '2.0'
|
||||
expect(json[:usage]).to be_a Hash
|
||||
expect(json[:software]).to be_a Hash
|
||||
|
||||
Reference in New Issue
Block a user