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:
@@ -32,25 +32,28 @@ describe Rack::Attack do
|
||||
describe 'throttle excessive sign-up requests by IP address' do
|
||||
context 'through the website' do
|
||||
let(:limit) { 25 }
|
||||
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
let(:request) { -> { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
|
||||
context 'for exact path' do
|
||||
let(:path) { '/auth' }
|
||||
let(:path) { '/auth' }
|
||||
|
||||
it_behaves_like 'throttled endpoint'
|
||||
end
|
||||
|
||||
context 'for path with format' do
|
||||
let(:path) { '/auth.html' }
|
||||
let(:path) { '/auth.html' }
|
||||
|
||||
it_behaves_like 'throttled endpoint'
|
||||
end
|
||||
end
|
||||
|
||||
context 'through the API' do
|
||||
let(:limit) { 5 }
|
||||
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
let(:request) { -> { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
|
||||
context 'for exact path' do
|
||||
let(:path) { '/api/v1/accounts' }
|
||||
let(:path) { '/api/v1/accounts' }
|
||||
|
||||
it_behaves_like 'throttled endpoint'
|
||||
end
|
||||
|
||||
@@ -67,15 +70,17 @@ describe Rack::Attack do
|
||||
|
||||
describe 'throttle excessive sign-in requests by IP address' do
|
||||
let(:limit) { 25 }
|
||||
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
let(:request) { -> { post path, {}, 'REMOTE_ADDR' => remote_ip } }
|
||||
|
||||
context 'for exact path' do
|
||||
let(:path) { '/auth/sign_in' }
|
||||
let(:path) { '/auth/sign_in' }
|
||||
|
||||
it_behaves_like 'throttled endpoint'
|
||||
end
|
||||
|
||||
context 'for path with format' do
|
||||
let(:path) { '/auth/sign_in.html' }
|
||||
let(:path) { '/auth/sign_in.html' }
|
||||
|
||||
it_behaves_like 'throttled endpoint'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:account_moderation_note) do
|
||||
content "MyText"
|
||||
content 'MyText'
|
||||
account nil
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator(:account_note) do
|
||||
account
|
||||
target_account { Fabricate(:account) }
|
||||
comment "User note text"
|
||||
comment 'User note text'
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:account_stat) do
|
||||
account nil
|
||||
statuses_count ""
|
||||
following_count ""
|
||||
followers_count ""
|
||||
statuses_count ''
|
||||
following_count ''
|
||||
followers_count ''
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Fabricator(:account_tag_stat) do
|
||||
accounts_count ""
|
||||
accounts_count ''
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Fabricator(:account_warning_preset) do
|
||||
text "MyText"
|
||||
text 'MyText'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator('Admin::ActionLog') do
|
||||
account nil
|
||||
action "MyString"
|
||||
action 'MyString'
|
||||
target nil
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:canonical_email_block) do
|
||||
email "test@example.com"
|
||||
email 'test@example.com'
|
||||
reference_account { Fabricate(:account) }
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:conversation_account) do
|
||||
account nil
|
||||
conversation nil
|
||||
participant_account_ids ""
|
||||
participant_account_ids ''
|
||||
last_status nil
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Fabricator(:custom_emoji_category) do
|
||||
name "MyString"
|
||||
name 'MyString'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:custom_filter_keyword) do
|
||||
custom_filter
|
||||
keyword 'discourse'
|
||||
keyword 'discourse'
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Fabricator(:domain_allow) do
|
||||
domain "MyString"
|
||||
domain 'MyString'
|
||||
end
|
||||
|
||||
@@ -3,6 +3,6 @@ Fabricator(:encrypted_message) do
|
||||
from_account
|
||||
from_device_id { Faker::Number.number(digits: 5) }
|
||||
type 0
|
||||
body ""
|
||||
message_franking ""
|
||||
body ''
|
||||
message_franking ''
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator(:identity) do
|
||||
user nil
|
||||
provider "MyString"
|
||||
uid "MyString"
|
||||
provider 'MyString'
|
||||
uid 'MyString'
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:ip_block) do
|
||||
ip ""
|
||||
severity ""
|
||||
expires_at "2020-10-08 22:20:37"
|
||||
comment "MyText"
|
||||
end
|
||||
ip ''
|
||||
severity ''
|
||||
expires_at '2020-10-08 22:20:37'
|
||||
comment 'MyText'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:list) do
|
||||
account
|
||||
title "MyString"
|
||||
title 'MyString'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator(:poll_vote) do
|
||||
account
|
||||
poll
|
||||
choice 0
|
||||
choice 0
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:relay) do
|
||||
inbox_url "https://example.com/inbox"
|
||||
inbox_url 'https://example.com/inbox'
|
||||
state :idle
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:report) do
|
||||
account
|
||||
target_account { Fabricate(:account) }
|
||||
comment "You nasty"
|
||||
comment 'You nasty'
|
||||
action_taken_at nil
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator(:report_note) do
|
||||
report
|
||||
account { Fabricate(:account) }
|
||||
content "Test Content"
|
||||
content 'Test Content'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Fabricator(:session_activation) do
|
||||
user
|
||||
session_id "MyString"
|
||||
session_id 'MyString'
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Fabricator(:status_edit) do
|
||||
status nil
|
||||
account nil
|
||||
text "MyText"
|
||||
spoiler_text "MyText"
|
||||
text 'MyText'
|
||||
spoiler_text 'MyText'
|
||||
media_attachments_changed false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:status) do
|
||||
account
|
||||
text "Lorem ipsum dolor sit amet"
|
||||
text 'Lorem ipsum dolor sit amet'
|
||||
|
||||
after_build do |status|
|
||||
status.uri = Faker::Internet.device_token if !status.account.local? && status.uri.nil?
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Fabricator(:status_stat) do
|
||||
status_id nil
|
||||
replies_count ""
|
||||
reblogs_count ""
|
||||
favourites_count ""
|
||||
replies_count ''
|
||||
reblogs_count ''
|
||||
favourites_count ''
|
||||
end
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
Fabricator(:system_key) do
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Fabricator(:user) do
|
||||
account { Fabricate.build(:account, user: nil) }
|
||||
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||
password "123456789"
|
||||
password '123456789'
|
||||
confirmed_at { Time.zone.now }
|
||||
agreement true
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fabricator(:user_role) do
|
||||
name "MyString"
|
||||
color ""
|
||||
name 'MyString'
|
||||
color ''
|
||||
permissions 0
|
||||
end
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Log in' do
|
||||
describe 'Log in' do
|
||||
include ProfileStories
|
||||
|
||||
given(:email) { "test@example.com" }
|
||||
given(:password) { "password" }
|
||||
given(:confirmed_at) { Time.zone.now }
|
||||
subject { page }
|
||||
|
||||
background do
|
||||
let(:email) { 'test@example.com' }
|
||||
let(:password) { 'password' }
|
||||
let(:confirmed_at) { Time.zone.now }
|
||||
|
||||
before do
|
||||
as_a_registered_user
|
||||
visit new_user_session_path
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
||||
scenario 'A valid email and password user is able to log in' do
|
||||
it 'A valid email and password user is able to log in' do
|
||||
fill_in 'user_email', with: email
|
||||
fill_in 'user_password', with: password
|
||||
click_on I18n.t('auth.login')
|
||||
@@ -24,7 +24,7 @@ feature 'Log in' do
|
||||
is_expected.to have_css('div.app-holder')
|
||||
end
|
||||
|
||||
scenario 'A invalid email and password user is not able to log in' do
|
||||
it 'A invalid email and password user is not able to log in' do
|
||||
fill_in 'user_email', with: 'invalid_email'
|
||||
fill_in 'user_password', with: 'invalid_password'
|
||||
click_on I18n.t('auth.login')
|
||||
@@ -33,9 +33,9 @@ feature 'Log in' do
|
||||
end
|
||||
|
||||
context do
|
||||
given(:confirmed_at) { nil }
|
||||
let(:confirmed_at) { nil }
|
||||
|
||||
scenario 'A unconfirmed user is able to log in' do
|
||||
it 'A unconfirmed user is able to log in' do
|
||||
fill_in 'user_email', with: email
|
||||
fill_in 'user_password', with: password
|
||||
click_on I18n.t('auth.login')
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Profile' do
|
||||
describe 'Profile' do
|
||||
include ProfileStories
|
||||
|
||||
given(:local_domain) { ENV['LOCAL_DOMAIN'] }
|
||||
subject { page }
|
||||
|
||||
background do
|
||||
let(:local_domain) { ENV['LOCAL_DOMAIN'] }
|
||||
|
||||
before do
|
||||
as_a_logged_in_user
|
||||
with_alice_as_local_user
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
||||
scenario 'I can view Annes public account' do
|
||||
it 'I can view Annes public account' do
|
||||
visit account_path('alice')
|
||||
|
||||
is_expected.to have_title("alice (@alice@#{local_domain})")
|
||||
end
|
||||
|
||||
scenario 'I can change my account' do
|
||||
it 'I can change my account' do
|
||||
visit settings_profile_path
|
||||
|
||||
fill_in 'Display name', with: 'Bob'
|
||||
|
||||
@@ -13,15 +13,15 @@ RSpec.describe AccountsHelper, type: :helper do
|
||||
|
||||
describe '#display_name' do
|
||||
it 'uses the display name when it exists' do
|
||||
account = Account.new(display_name: "Display", username: "Username")
|
||||
account = Account.new(display_name: 'Display', username: 'Username')
|
||||
|
||||
expect(helper.display_name(account)).to eq "Display"
|
||||
expect(helper.display_name(account)).to eq 'Display'
|
||||
end
|
||||
|
||||
it 'uses the username when display name is nil' do
|
||||
account = Account.new(display_name: nil, username: "Username")
|
||||
account = Account.new(display_name: nil, username: 'Username')
|
||||
|
||||
expect(helper.display_name(account)).to eq "Username"
|
||||
expect(helper.display_name(account)).to eq 'Username'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ describe ApplicationHelper do
|
||||
it 'returns active when on the current page' do
|
||||
allow(helper).to receive(:current_page?).and_return(true)
|
||||
|
||||
result = helper.active_nav_class("/test")
|
||||
expect(result).to eq "active"
|
||||
result = helper.active_nav_class('/test')
|
||||
expect(result).to eq 'active'
|
||||
end
|
||||
|
||||
it 'returns active when on a current page' do
|
||||
@@ -14,14 +14,14 @@ describe ApplicationHelper do
|
||||
allow(helper).to receive(:current_page?).with('/test').and_return(true)
|
||||
|
||||
result = helper.active_nav_class('/foo', '/test')
|
||||
expect(result).to eq "active"
|
||||
expect(result).to eq 'active'
|
||||
end
|
||||
|
||||
it 'returns empty string when not on current page' do
|
||||
allow(helper).to receive(:current_page?).and_return(false)
|
||||
|
||||
result = helper.active_nav_class("/test")
|
||||
expect(result).to eq ""
|
||||
result = helper.active_nav_class('/test')
|
||||
expect(result).to eq ''
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,6 +82,7 @@ describe ApplicationHelper do
|
||||
before do
|
||||
allow(helper).to receive(:user_signed_in?).and_return(true)
|
||||
end
|
||||
|
||||
it 'does not show landing strip' do
|
||||
expect(helper.show_landing_strip?).to eq false
|
||||
end
|
||||
|
||||
@@ -113,7 +113,7 @@ describe JsonLdHelper do
|
||||
{
|
||||
'type' => 'Mention',
|
||||
'href' => ['foo'],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
'signature' => {
|
||||
|
||||
@@ -82,10 +82,10 @@ RSpec.describe ActivityPub::Activity::Announce do
|
||||
content: 'Lorem ipsum',
|
||||
attributedTo: 'https://example.com/actor',
|
||||
to: {
|
||||
'type': 'OrderedCollection',
|
||||
'id': 'http://example.com/followers',
|
||||
'first': 'http://example.com/followers?page=true',
|
||||
}
|
||||
type: 'OrderedCollection',
|
||||
id: 'http://example.com/followers',
|
||||
first: 'http://example.com/followers?page=true',
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -252,10 +252,10 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: {
|
||||
'type': 'OrderedCollection',
|
||||
'id': 'http://example.com/followers',
|
||||
'first': 'http://example.com/followers?page=true',
|
||||
}
|
||||
type: 'OrderedCollection',
|
||||
id: 'http://example.com/followers',
|
||||
first: 'http://example.com/followers?page=true',
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -454,7 +454,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'with media attachments with long description' do
|
||||
let(:object_json) do
|
||||
{
|
||||
@@ -733,7 +732,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
replies: {
|
||||
type: 'Collection',
|
||||
totalItems: 3,
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -763,7 +762,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
name: 'Yellow',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -788,7 +787,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
name: 'Yellow',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ RSpec.describe ActivityPub::Activity::Flag do
|
||||
|
||||
describe '#perform with a defined uri' do
|
||||
subject { described_class.new(json, sender) }
|
||||
let (:flag_id) { 'http://example.com/reports/1' }
|
||||
let(:flag_id) { 'http://example.com/reports/1' }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
|
||||
@@ -20,7 +20,7 @@ describe Extractor do
|
||||
text = '@screen_name'
|
||||
extracted = Extractor.extract_mentions_or_lists_with_indices(text)
|
||||
expect(extracted).to eq [
|
||||
{ screen_name: 'screen_name', indices: [ 0, 12 ] }
|
||||
{ screen_name: 'screen_name', indices: [0, 12] },
|
||||
]
|
||||
end
|
||||
|
||||
@@ -44,19 +44,19 @@ describe Extractor do
|
||||
it 'does not exclude normal hash text before ://' do
|
||||
text = '#hashtag://'
|
||||
extracted = Extractor.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
|
||||
expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
|
||||
end
|
||||
|
||||
it 'excludes http://' do
|
||||
text = '#hashtaghttp://'
|
||||
extracted = Extractor.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
|
||||
expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
|
||||
end
|
||||
|
||||
it 'excludes https://' do
|
||||
text = '#hashtaghttps://'
|
||||
extracted = Extractor.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
|
||||
expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
|
||||
end
|
||||
|
||||
it 'yields hashtags if a block is given' do
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'rails_helper'
|
||||
|
||||
describe FastIpMap do
|
||||
describe '#include?' do
|
||||
subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')])}
|
||||
subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')]) }
|
||||
|
||||
it 'returns true for an exact match' do
|
||||
expect(subject.include?(IPAddr.new('189.45.86.3'))).to be true
|
||||
|
||||
@@ -423,7 +423,7 @@ RSpec.describe FeedManager do
|
||||
|
||||
FeedManager.instance.merge_into_home(account, reblog.account)
|
||||
|
||||
expect(redis.zscore("feed:home:0", reblog.id)).to eq nil
|
||||
expect(redis.zscore('feed:home:0', reblog.id)).to eq nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -39,17 +39,17 @@ RSpec.describe LinkDetailsExtractor do
|
||||
let(:original_url) { 'https://example.com/page.html' }
|
||||
|
||||
context 'and is wrapped in CDATA tags' do
|
||||
let(:html) { <<-HTML }
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/ld+json">
|
||||
//<![CDATA[
|
||||
{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"https://example.com/page.html","headline":"Foo","datePublished":"2022-01-31T19:53:00+00:00","url":"https://example.com/page.html","description":"Bar","author":{"@type":"Person","name":"Hoge"},"publisher":{"@type":"Organization","name":"Baz"}}
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
let(:html) { <<~HTML }
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/ld+json">
|
||||
//<![CDATA[
|
||||
{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"https://example.com/page.html","headline":"Foo","datePublished":"2022-01-31T19:53:00+00:00","url":"https://example.com/page.html","description":"Bar","author":{"@type":"Person","name":"Hoge"},"publisher":{"@type":"Organization","name":"Baz"}}
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
HTML
|
||||
|
||||
describe '#title' do
|
||||
@@ -78,57 +78,57 @@ RSpec.describe LinkDetailsExtractor do
|
||||
end
|
||||
|
||||
context 'but the first tag is invalid JSON' do
|
||||
let(:html) { <<-HTML }
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context":"https://schema.org",
|
||||
"@type":"ItemList",
|
||||
"url":"https://example.com/page.html",
|
||||
"name":"Foo",
|
||||
"description":"Bar"
|
||||
},
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement":[
|
||||
{
|
||||
"@type":"ListItem",
|
||||
"position":1,
|
||||
"item":{
|
||||
"@id":"https://www.example.com",
|
||||
"name":"Baz"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context":"https://schema.org",
|
||||
"@type":"NewsArticle",
|
||||
"mainEntityOfPage": {
|
||||
"@type":"WebPage",
|
||||
"@id": "http://example.com/page.html"
|
||||
},
|
||||
"headline": "Foo",
|
||||
"description": "Bar",
|
||||
"datePublished": "2022-01-31T19:46:00+00:00",
|
||||
"author": {
|
||||
"@type": "Organization",
|
||||
"name": "Hoge"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "NewsMediaOrganization",
|
||||
"name":"Baz",
|
||||
"url":"https://example.com/"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
let(:html) { <<~HTML }
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context":"https://schema.org",
|
||||
"@type":"ItemList",
|
||||
"url":"https://example.com/page.html",
|
||||
"name":"Foo",
|
||||
"description":"Bar"
|
||||
},
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement":[
|
||||
{
|
||||
"@type":"ListItem",
|
||||
"position":1,
|
||||
"item":{
|
||||
"@id":"https://www.example.com",
|
||||
"name":"Baz"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context":"https://schema.org",
|
||||
"@type":"NewsArticle",
|
||||
"mainEntityOfPage": {
|
||||
"@type":"WebPage",
|
||||
"@id": "http://example.com/page.html"
|
||||
},
|
||||
"headline": "Foo",
|
||||
"description": "Bar",
|
||||
"datePublished": "2022-01-31T19:46:00+00:00",
|
||||
"author": {
|
||||
"@type": "Organization",
|
||||
"name": "Hoge"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "NewsMediaOrganization",
|
||||
"name":"Baz",
|
||||
"url":"https://example.com/"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
HTML
|
||||
|
||||
describe '#title' do
|
||||
|
||||
@@ -43,7 +43,7 @@ describe Request do
|
||||
before { stub_request(:get, 'http://example.com') }
|
||||
|
||||
it 'executes a HTTP request' do
|
||||
expect { |block| subject.perform &block }.to yield_control
|
||||
expect { |block| subject.perform(&block) }.to yield_control
|
||||
expect(a_request(:get, 'http://example.com')).to have_been_made.once
|
||||
end
|
||||
|
||||
@@ -54,18 +54,18 @@ describe Request do
|
||||
allow(resolver).to receive(:timeouts=).and_return(nil)
|
||||
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
|
||||
|
||||
expect { |block| subject.perform &block }.to yield_control
|
||||
expect { |block| subject.perform(&block) }.to yield_control
|
||||
expect(a_request(:get, 'http://example.com')).to have_been_made.once
|
||||
end
|
||||
|
||||
it 'sets headers' do
|
||||
expect { |block| subject.perform &block }.to yield_control
|
||||
expect { |block| subject.perform(&block) }.to yield_control
|
||||
expect(a_request(:get, 'http://example.com').with(headers: subject.headers)).to have_been_made
|
||||
end
|
||||
|
||||
it 'closes underlying connection' do
|
||||
expect_any_instance_of(HTTP::Client).to receive(:close)
|
||||
expect { |block| subject.perform &block }.to yield_control
|
||||
expect { |block| subject.perform(&block) }.to yield_control
|
||||
end
|
||||
|
||||
it 'returns response which implements body_with_limit' do
|
||||
|
||||
@@ -10,7 +10,7 @@ RSpec.describe Settings::Extend do
|
||||
describe '#settings' do
|
||||
it 'sets @settings as an instance of Settings::ScopedSettings' do
|
||||
user = Fabricate(:user)
|
||||
expect(user.settings).to be_kind_of Settings::ScopedSettings
|
||||
expect(user.settings).to be_a Settings::ScopedSettings
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,6 +32,7 @@ describe StatusFilter do
|
||||
|
||||
context 'with real account' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
subject { described_class.new(status, account) }
|
||||
|
||||
context 'when there are no connections' do
|
||||
|
||||
@@ -223,7 +223,7 @@ RSpec.describe TextFormatter do
|
||||
end
|
||||
|
||||
context 'given a URL containing unsafe code (XSS attack, visible part)' do
|
||||
let(:text) { %q{http://example.com/b<del>b</del>} }
|
||||
let(:text) { 'http://example.com/b<del>b</del>' }
|
||||
|
||||
it 'does not include the HTML in the URL' do
|
||||
is_expected.to include '"http://example.com/b"'
|
||||
@@ -235,7 +235,7 @@ RSpec.describe TextFormatter do
|
||||
end
|
||||
|
||||
context 'given a URL containing unsafe code (XSS attack, invisible part)' do
|
||||
let(:text) { %q{http://example.com/blahblahblahblah/a<script>alert("Hello")</script>} }
|
||||
let(:text) { 'http://example.com/blahblahblahblah/a<script>alert("Hello")</script>' }
|
||||
|
||||
it 'does not include the HTML in the URL' do
|
||||
is_expected.to include '"http://example.com/blahblahblahblah/a"'
|
||||
|
||||
@@ -14,9 +14,9 @@ describe WebfingerResource do
|
||||
it 'raises with a route whose controller is not AccountsController' do
|
||||
resource = 'https://example.com/users/alice/other'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'raises with a route whose action is not show' do
|
||||
@@ -29,17 +29,17 @@ describe WebfingerResource do
|
||||
|
||||
expect(Rails.application.routes).to receive(:recognize_path).with(resource).and_return(recognized).at_least(:once)
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'raises with a string that doesnt start with URL' do
|
||||
resource = 'website for http://example.com/users/alice/other'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end
|
||||
|
||||
it 'finds the username in a valid https route' do
|
||||
@@ -68,9 +68,9 @@ describe WebfingerResource do
|
||||
it 'raises on a non-local domain' do
|
||||
resource = 'user@remote-host.com'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'finds username for a local domain' do
|
||||
@@ -94,17 +94,17 @@ describe WebfingerResource do
|
||||
it 'raises on a non-local domain' do
|
||||
resource = 'acct:user@remote-host.com'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'raises on a nonsense domain' do
|
||||
resource = 'acct:user@remote-host@remote-hostess.remote.local@remote'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'finds the username for a local account if the domain is the local one' do
|
||||
@@ -128,9 +128,9 @@ describe WebfingerResource do
|
||||
it 'raises InvalidRequest' do
|
||||
resource = 'df/:dfkj'
|
||||
|
||||
expect {
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
}.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe NotificationMailer, type: :mailer do
|
||||
let(:receiver) { Fabricate(:user) }
|
||||
@@ -19,69 +19,69 @@ RSpec.describe NotificationMailer, type: :mailer do
|
||||
end
|
||||
end
|
||||
|
||||
describe "mention" do
|
||||
describe 'mention' do
|
||||
let(:mention) { Mention.create!(account: receiver.account, status: foreign_status) }
|
||||
let(:mail) { NotificationMailer.mention(receiver.account, Notification.create!(account: receiver.account, activity: mention)) }
|
||||
|
||||
include_examples 'localized subject', 'notification_mailer.mention.subject', name: 'bob'
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("You were mentioned by bob")
|
||||
it 'renders the headers' do
|
||||
expect(mail.subject).to eq('You were mentioned by bob')
|
||||
expect(mail.to).to eq([receiver.email])
|
||||
end
|
||||
|
||||
it "renders the body" do
|
||||
expect(mail.body.encoded).to match("You were mentioned by bob")
|
||||
it 'renders the body' do
|
||||
expect(mail.body.encoded).to match('You were mentioned by bob')
|
||||
expect(mail.body.encoded).to include 'The body of the foreign status'
|
||||
end
|
||||
end
|
||||
|
||||
describe "follow" do
|
||||
describe 'follow' do
|
||||
let(:follow) { sender.follow!(receiver.account) }
|
||||
let(:mail) { NotificationMailer.follow(receiver.account, Notification.create!(account: receiver.account, activity: follow)) }
|
||||
|
||||
include_examples 'localized subject', 'notification_mailer.follow.subject', name: 'bob'
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("bob is now following you")
|
||||
it 'renders the headers' do
|
||||
expect(mail.subject).to eq('bob is now following you')
|
||||
expect(mail.to).to eq([receiver.email])
|
||||
end
|
||||
|
||||
it "renders the body" do
|
||||
expect(mail.body.encoded).to match("bob is now following you")
|
||||
it 'renders the body' do
|
||||
expect(mail.body.encoded).to match('bob is now following you')
|
||||
end
|
||||
end
|
||||
|
||||
describe "favourite" do
|
||||
describe 'favourite' do
|
||||
let(:favourite) { Favourite.create!(account: sender, status: own_status) }
|
||||
let(:mail) { NotificationMailer.favourite(own_status.account, Notification.create!(account: receiver.account, activity: favourite)) }
|
||||
|
||||
include_examples 'localized subject', 'notification_mailer.favourite.subject', name: 'bob'
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("bob favourited your post")
|
||||
it 'renders the headers' do
|
||||
expect(mail.subject).to eq('bob favourited your post')
|
||||
expect(mail.to).to eq([receiver.email])
|
||||
end
|
||||
|
||||
it "renders the body" do
|
||||
expect(mail.body.encoded).to match("Your post was favourited by bob")
|
||||
it 'renders the body' do
|
||||
expect(mail.body.encoded).to match('Your post was favourited by bob')
|
||||
expect(mail.body.encoded).to include 'The body of the own status'
|
||||
end
|
||||
end
|
||||
|
||||
describe "reblog" do
|
||||
describe 'reblog' do
|
||||
let(:reblog) { Status.create!(account: sender, reblog: own_status) }
|
||||
let(:mail) { NotificationMailer.reblog(own_status.account, Notification.create!(account: receiver.account, activity: reblog)) }
|
||||
|
||||
include_examples 'localized subject', 'notification_mailer.reblog.subject', name: 'bob'
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("bob boosted your post")
|
||||
it 'renders the headers' do
|
||||
expect(mail.subject).to eq('bob boosted your post')
|
||||
expect(mail.to).to eq([receiver.email])
|
||||
end
|
||||
|
||||
it "renders the body" do
|
||||
expect(mail.body.encoded).to match("Your post was boosted by bob")
|
||||
it 'renders the body' do
|
||||
expect(mail.body.encoded).to match('Your post was boosted by bob')
|
||||
expect(mail.body.encoded).to include 'The body of the own status'
|
||||
end
|
||||
end
|
||||
@@ -98,7 +98,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
||||
end
|
||||
|
||||
it 'renders the body' do
|
||||
expect(mail.body.encoded).to match("bob has requested to follow you")
|
||||
expect(mail.body.encoded).to match('bob has requested to follow you')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -90,7 +90,7 @@ describe UserMailer, type: :mailer do
|
||||
|
||||
it 'renders warning notification' do
|
||||
receiver.update!(locale: nil)
|
||||
expect(mail.body.encoded).to include I18n.t("user_mailer.warning.title.suspend", acct: receiver.account.acct)
|
||||
expect(mail.body.encoded).to include I18n.t('user_mailer.warning.title.suspend', acct: receiver.account.acct)
|
||||
expect(mail.body.encoded).to include strike.text
|
||||
end
|
||||
end
|
||||
|
||||
@@ -97,7 +97,7 @@ RSpec.describe Account::Field, type: :model do
|
||||
expect(subject.verifiable?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'for text which is blank' do
|
||||
let(:value) { '' }
|
||||
|
||||
@@ -149,7 +149,7 @@ RSpec.describe Account::Field, type: :model do
|
||||
expect(subject.verifiable?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'for text which is blank' do
|
||||
let(:value) { '' }
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountAlias, type: :model do
|
||||
|
||||
end
|
||||
|
||||
+30
-29
@@ -3,6 +3,7 @@ require 'rails_helper'
|
||||
RSpec.describe Account, type: :model do
|
||||
context do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
subject { Fabricate(:account) }
|
||||
|
||||
describe '#suspend!' do
|
||||
@@ -344,9 +345,9 @@ RSpec.describe Account, type: :model do
|
||||
before do
|
||||
_missing = Fabricate(
|
||||
:account,
|
||||
display_name: "Missing",
|
||||
username: "missing",
|
||||
domain: "missing.com"
|
||||
display_name: 'Missing',
|
||||
username: 'missing',
|
||||
domain: 'missing.com'
|
||||
)
|
||||
end
|
||||
|
||||
@@ -404,58 +405,58 @@ RSpec.describe Account, type: :model do
|
||||
it 'finds accounts with matching display_name' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("display")
|
||||
results = Account.search_for('display')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'finds accounts with matching username' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("username")
|
||||
results = Account.search_for('username')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'finds accounts with matching domain' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("example")
|
||||
results = Account.search_for('example')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'limits by 10 by default' do
|
||||
11.times.each { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.search_for("display")
|
||||
11.times.each { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.search_for('display')
|
||||
expect(results.size).to eq 10
|
||||
end
|
||||
|
||||
it 'accepts arbitrary limits' do
|
||||
2.times.each { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.search_for("display", limit: 1)
|
||||
2.times.each { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.search_for('display', limit: 1)
|
||||
expect(results.size).to eq 1
|
||||
end
|
||||
|
||||
it 'ranks multiple matches higher' do
|
||||
matches = [
|
||||
{ username: "username", display_name: "username" },
|
||||
{ display_name: "Display Name", username: "username", domain: "example.com" },
|
||||
{ username: 'username', display_name: 'username' },
|
||||
{ display_name: 'Display Name', username: 'username', domain: 'example.com' },
|
||||
].map(&method(:Fabricate).curry(2).call(:account))
|
||||
|
||||
results = Account.search_for("username")
|
||||
results = Account.search_for('username')
|
||||
expect(results).to eq matches
|
||||
end
|
||||
end
|
||||
@@ -581,23 +582,23 @@ RSpec.describe Account, type: :model do
|
||||
end
|
||||
|
||||
it 'limits by 10 by default' do
|
||||
11.times { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.advanced_search_for("display", account)
|
||||
11.times { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.advanced_search_for('display', account)
|
||||
expect(results.size).to eq 10
|
||||
end
|
||||
|
||||
it 'accepts arbitrary limits' do
|
||||
2.times { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.advanced_search_for("display", account, limit: 1)
|
||||
2.times { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.advanced_search_for('display', account, limit: 1)
|
||||
expect(results.size).to eq 1
|
||||
end
|
||||
|
||||
it 'ranks followed accounts higher' do
|
||||
match = Fabricate(:account, username: "Matching")
|
||||
followed_match = Fabricate(:account, username: "Matcher")
|
||||
match = Fabricate(:account, username: 'Matching')
|
||||
followed_match = Fabricate(:account, username: 'Matcher')
|
||||
Fabricate(:follow, account: account, target_account: followed_match)
|
||||
|
||||
results = Account.advanced_search_for("match", account)
|
||||
results = Account.advanced_search_for('match', account)
|
||||
expect(results).to eq [followed_match, match]
|
||||
expect(results.first.rank).to be > results.last.rank
|
||||
end
|
||||
|
||||
@@ -16,16 +16,15 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
||||
context 'when widening a policy' do
|
||||
let!(:account_statuses_cleanup_policy) do
|
||||
Fabricate(:account_statuses_cleanup_policy,
|
||||
account: account,
|
||||
keep_direct: true,
|
||||
keep_pinned: true,
|
||||
keep_polls: true,
|
||||
keep_media: true,
|
||||
keep_self_fav: true,
|
||||
keep_self_bookmark: true,
|
||||
min_favs: 1,
|
||||
min_reblogs: 1
|
||||
)
|
||||
account: account,
|
||||
keep_direct: true,
|
||||
keep_pinned: true,
|
||||
keep_polls: true,
|
||||
keep_media: true,
|
||||
keep_self_fav: true,
|
||||
keep_self_bookmark: true,
|
||||
min_favs: 1,
|
||||
min_reblogs: 1)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -35,77 +34,76 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
||||
it 'invalidates last_inspected when widened because of keep_direct' do
|
||||
account_statuses_cleanup_policy.keep_direct = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_pinned' do
|
||||
account_statuses_cleanup_policy.keep_pinned = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_polls' do
|
||||
account_statuses_cleanup_policy.keep_polls = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_media' do
|
||||
account_statuses_cleanup_policy.keep_media = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_self_fav' do
|
||||
account_statuses_cleanup_policy.keep_self_fav = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_self_bookmark' do
|
||||
account_statuses_cleanup_policy.keep_self_bookmark = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of higher min_favs' do
|
||||
account_statuses_cleanup_policy.min_favs = 5
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of disabled min_favs' do
|
||||
account_statuses_cleanup_policy.min_favs = nil
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of higher min_reblogs' do
|
||||
account_statuses_cleanup_policy.min_reblogs = 5
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of disable min_reblogs' do
|
||||
account_statuses_cleanup_policy.min_reblogs = nil
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when narrowing a policy' do
|
||||
let!(:account_statuses_cleanup_policy) do
|
||||
Fabricate(:account_statuses_cleanup_policy,
|
||||
account: account,
|
||||
keep_direct: false,
|
||||
keep_pinned: false,
|
||||
keep_polls: false,
|
||||
keep_media: false,
|
||||
keep_self_fav: false,
|
||||
keep_self_bookmark: false,
|
||||
min_favs: nil,
|
||||
min_reblogs: nil
|
||||
)
|
||||
account: account,
|
||||
keep_direct: false,
|
||||
keep_pinned: false,
|
||||
keep_polls: false,
|
||||
keep_media: false,
|
||||
keep_self_fav: false,
|
||||
keep_self_bookmark: false,
|
||||
min_favs: nil,
|
||||
min_reblogs: nil)
|
||||
end
|
||||
|
||||
it 'does not unnecessarily invalidate last_inspected' do
|
||||
@@ -136,6 +134,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
||||
describe '#invalidate_last_inspected' do
|
||||
let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
|
||||
let(:status) { Fabricate(:status, id: 10, account: account) }
|
||||
|
||||
subject { account_statuses_cleanup_policy.invalidate_last_inspected(status, action) }
|
||||
|
||||
before do
|
||||
@@ -232,7 +231,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
||||
end
|
||||
|
||||
describe '#compute_cutoff_id' do
|
||||
let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
|
||||
let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
|
||||
let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
|
||||
|
||||
subject { account_statuses_cleanup_policy.compute_cutoff_id }
|
||||
|
||||
@@ -101,7 +101,7 @@ describe AccountInteractions do
|
||||
describe '#follow!' do
|
||||
it 'creates and returns Follow' do
|
||||
expect do
|
||||
expect(account.follow!(target_account)).to be_kind_of Follow
|
||||
expect(account.follow!(target_account)).to be_a Follow
|
||||
end.to change { account.following.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -109,7 +109,7 @@ describe AccountInteractions do
|
||||
describe '#block' do
|
||||
it 'creates and returns Block' do
|
||||
expect do
|
||||
expect(account.block!(target_account)).to be_kind_of Block
|
||||
expect(account.block!(target_account)).to be_a Block
|
||||
end.to change { account.block_relationships.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -123,7 +123,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'creates Mute, and returns Mute' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { account.mute_relationships.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -133,7 +133,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'creates Mute, and returns Mute' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { account.mute_relationships.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -143,7 +143,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'creates Mute, and returns Mute' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { account.mute_relationships.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -169,7 +169,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute without updating mute.hide_notifications' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.not_to change { mute.reload.hide_notifications? }.from(true)
|
||||
end
|
||||
end
|
||||
@@ -179,7 +179,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute, and updates mute.hide_notifications false' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { mute.reload.hide_notifications? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
@@ -189,7 +189,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute without updating mute.hide_notifications' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.not_to change { mute.reload.hide_notifications? }.from(true)
|
||||
end
|
||||
end
|
||||
@@ -203,7 +203,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute, and updates mute.hide_notifications true' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
@@ -213,7 +213,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute without updating mute.hide_notifications' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.not_to change { mute.reload.hide_notifications? }.from(false)
|
||||
end
|
||||
end
|
||||
@@ -223,7 +223,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'returns Mute, and updates mute.hide_notifications true' do
|
||||
expect do
|
||||
expect(subject).to be_kind_of Mute
|
||||
expect(subject).to be_a Mute
|
||||
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
@@ -238,7 +238,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'creates and returns ConversationMute' do
|
||||
expect do
|
||||
is_expected.to be_kind_of ConversationMute
|
||||
is_expected.to be_a ConversationMute
|
||||
end.to change { account.conversation_mutes.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -250,7 +250,7 @@ describe AccountInteractions do
|
||||
|
||||
it 'creates and returns AccountDomainBlock' do
|
||||
expect do
|
||||
is_expected.to be_kind_of AccountDomainBlock
|
||||
is_expected.to be_a AccountDomainBlock
|
||||
end.to change { account.domain_blocks.count }.by 1
|
||||
end
|
||||
end
|
||||
@@ -261,7 +261,7 @@ describe AccountInteractions do
|
||||
context 'following target_account' do
|
||||
it 'returns destroyed Follow' do
|
||||
account.active_relationships.create(target_account: target_account)
|
||||
is_expected.to be_kind_of Follow
|
||||
is_expected.to be_a Follow
|
||||
expect(subject).to be_destroyed
|
||||
end
|
||||
end
|
||||
@@ -279,7 +279,7 @@ describe AccountInteractions do
|
||||
context 'blocking target_account' do
|
||||
it 'returns destroyed Block' do
|
||||
account.block_relationships.create(target_account: target_account)
|
||||
is_expected.to be_kind_of Block
|
||||
is_expected.to be_a Block
|
||||
expect(subject).to be_destroyed
|
||||
end
|
||||
end
|
||||
@@ -297,7 +297,7 @@ describe AccountInteractions do
|
||||
context 'muting target_account' do
|
||||
it 'returns destroyed Mute' do
|
||||
account.mute_relationships.create(target_account: target_account)
|
||||
is_expected.to be_kind_of Mute
|
||||
is_expected.to be_a Mute
|
||||
expect(subject).to be_destroyed
|
||||
end
|
||||
end
|
||||
@@ -317,14 +317,14 @@ describe AccountInteractions do
|
||||
context 'muting the conversation' do
|
||||
it 'returns destroyed ConversationMute' do
|
||||
account.conversation_mutes.create(conversation: conversation)
|
||||
is_expected.to be_kind_of ConversationMute
|
||||
is_expected.to be_a ConversationMute
|
||||
expect(subject).to be_destroyed
|
||||
end
|
||||
end
|
||||
|
||||
context 'not muting the conversation' do
|
||||
it 'returns nil' do
|
||||
is_expected.to be nil
|
||||
is_expected.to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -338,7 +338,7 @@ describe AccountInteractions do
|
||||
it 'returns destroyed AccountDomainBlock' do
|
||||
account_domain_block = Fabricate(:account_domain_block, domain: domain)
|
||||
account.domain_blocks << account_domain_block
|
||||
is_expected.to be_kind_of AccountDomainBlock
|
||||
is_expected.to be_a AccountDomainBlock
|
||||
expect(subject).to be_destroyed
|
||||
end
|
||||
end
|
||||
@@ -407,7 +407,7 @@ describe AccountInteractions do
|
||||
subject { account.domain_blocking?(domain) }
|
||||
|
||||
context 'blocking the domain' do
|
||||
it' returns true' do
|
||||
it 'returns true' do
|
||||
account_domain_block = Fabricate(:account_domain_block, domain: domain)
|
||||
account.domain_blocks << account_domain_block
|
||||
is_expected.to be true
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe CustomEmojiFilter do
|
||||
let(:params) { { local: true } }
|
||||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
expect(subject).to be_kind_of(ActiveRecord::Relation)
|
||||
expect(subject).to be_a(ActiveRecord::Relation)
|
||||
expect(subject).to match_array([custom_emoji_2])
|
||||
end
|
||||
end
|
||||
@@ -24,7 +24,7 @@ RSpec.describe CustomEmojiFilter do
|
||||
let(:params) { { remote: true } }
|
||||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
expect(subject).to be_kind_of(ActiveRecord::Relation)
|
||||
expect(subject).to be_a(ActiveRecord::Relation)
|
||||
expect(subject).to match_array([custom_emoji_0, custom_emoji_1])
|
||||
end
|
||||
end
|
||||
@@ -33,7 +33,7 @@ RSpec.describe CustomEmojiFilter do
|
||||
let(:params) { { by_domain: 'a' } }
|
||||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
expect(subject).to be_kind_of(ActiveRecord::Relation)
|
||||
expect(subject).to be_a(ActiveRecord::Relation)
|
||||
expect(subject).to match_array([custom_emoji_0])
|
||||
end
|
||||
end
|
||||
@@ -42,7 +42,7 @@ RSpec.describe CustomEmojiFilter do
|
||||
let(:params) { { shortcode: 'hoge' } }
|
||||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
expect(subject).to be_kind_of(ActiveRecord::Relation)
|
||||
expect(subject).to be_a(ActiveRecord::Relation)
|
||||
expect(subject).to match_array([custom_emoji_2])
|
||||
end
|
||||
end
|
||||
@@ -62,7 +62,7 @@ RSpec.describe CustomEmojiFilter do
|
||||
let(:params) { { hoge: nil } }
|
||||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
expect(subject).to be_kind_of(ActiveRecord::Relation)
|
||||
expect(subject).to be_a(ActiveRecord::Relation)
|
||||
expect(subject).to match_array([custom_emoji_0, custom_emoji_1, custom_emoji_2])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ RSpec.describe CustomEmoji, type: :model do
|
||||
describe 'pre_validation' do
|
||||
let(:custom_emoji) { Fabricate(:custom_emoji, domain: 'wWw.MaStOdOn.CoM') }
|
||||
|
||||
it 'should downcase' do
|
||||
it 'downcases' do
|
||||
custom_emoji.valid?
|
||||
expect(custom_emoji.domain).to eq('www.mastodon.com')
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Device, type: :model do
|
||||
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user