mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-18 12:30:03 +00:00
Fix RSpec/MultipleSubjects cop (#24738)
This commit is contained in:
parent
bdcd8a9e88
commit
cf18cc2891
|
@ -732,17 +732,6 @@ RSpec/MultipleExpectations:
|
||||||
RSpec/MultipleMemoizedHelpers:
|
RSpec/MultipleMemoizedHelpers:
|
||||||
Max: 21
|
Max: 21
|
||||||
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
RSpec/MultipleSubjects:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/activitypub/collections_controller_spec.rb'
|
|
||||||
- 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb'
|
|
||||||
- 'spec/controllers/activitypub/outboxes_controller_spec.rb'
|
|
||||||
- 'spec/controllers/api/web/embeds_controller_spec.rb'
|
|
||||||
- 'spec/controllers/emojis_controller_spec.rb'
|
|
||||||
- 'spec/controllers/follower_accounts_controller_spec.rb'
|
|
||||||
- 'spec/controllers/following_accounts_controller_spec.rb'
|
|
||||||
|
|
||||||
# Configuration parameters: AllowedGroups.
|
# Configuration parameters: AllowedGroups.
|
||||||
RSpec/NestedGroups:
|
RSpec/NestedGroups:
|
||||||
Max: 6
|
Max: 6
|
||||||
|
|
|
@ -35,10 +35,9 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
context 'when id is "featured"' do
|
context 'when id is "featured"' do
|
||||||
context 'without signature' do
|
context 'without signature' do
|
||||||
subject(:body) { body_as_json }
|
|
||||||
|
|
||||||
subject(:response) { get :show, params: { id: 'featured', account_username: account.username } }
|
subject(:response) { get :show, params: { id: 'featured', account_username: account.username } }
|
||||||
|
|
||||||
|
let(:body) { body_as_json }
|
||||||
let(:remote_account) { nil }
|
let(:remote_account) { nil }
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
|
|
|
@ -34,10 +34,9 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with signature from example.com' do
|
context 'with signature from example.com' do
|
||||||
subject(:body) { body_as_json }
|
|
||||||
|
|
||||||
subject(:response) { get :show, params: { account_username: account.username } }
|
subject(:response) { get :show, params: { account_username: account.username } }
|
||||||
|
|
||||||
|
let(:body) { body_as_json }
|
||||||
let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') }
|
let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') }
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
|
|
|
@ -35,10 +35,9 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
context 'without signature' do
|
context 'without signature' do
|
||||||
subject(:body) { body_as_json }
|
|
||||||
|
|
||||||
subject(:response) { get :show, params: { account_username: account.username, page: page } }
|
subject(:response) { get :show, params: { account_username: account.username, page: page } }
|
||||||
|
|
||||||
|
let(:body) { body_as_json }
|
||||||
let(:remote_account) { nil }
|
let(:remote_account) { nil }
|
||||||
|
|
||||||
context 'with page not requested' do
|
context 'with page not requested' do
|
||||||
|
|
|
@ -10,10 +10,10 @@ describe Api::Web::EmbedsController do
|
||||||
before { sign_in user }
|
before { sign_in user }
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
subject(:response) { post :create, params: { url: url } }
|
|
||||||
|
|
||||||
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
||||||
|
|
||||||
|
let(:response) { post :create, params: { url: url } }
|
||||||
|
|
||||||
context 'when successfully finds status' do
|
context 'when successfully finds status' do
|
||||||
let(:status) { Fabricate(:status) }
|
let(:status) { Fabricate(:status) }
|
||||||
let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" }
|
let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" }
|
||||||
|
|
|
@ -8,10 +8,10 @@ describe EmojisController do
|
||||||
let(:emoji) { Fabricate(:custom_emoji) }
|
let(:emoji) { Fabricate(:custom_emoji) }
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
subject(:response) { get :show, params: { id: emoji.id, format: :json } }
|
|
||||||
|
|
||||||
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
|
||||||
|
|
||||||
|
let(:response) { get :show, params: { id: emoji.id, format: :json } }
|
||||||
|
|
||||||
it 'returns the right response' do
|
it 'returns the right response' do
|
||||||
expect(response).to have_http_status 200
|
expect(response).to have_http_status 200
|
||||||
expect(body[:name]).to eq ':coolcat:'
|
expect(body[:name]).to eq ':coolcat:'
|
||||||
|
|
|
@ -39,10 +39,10 @@ describe FollowerAccountsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when format is json' do
|
context 'when format is json' do
|
||||||
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
|
||||||
|
|
||||||
subject(:body) { response.parsed_body }
|
subject(:body) { response.parsed_body }
|
||||||
|
|
||||||
|
let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||||
|
|
||||||
context 'with page' do
|
context 'with page' do
|
||||||
let(:page) { 1 }
|
let(:page) { 1 }
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,10 @@ describe FollowingAccountsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when format is json' do
|
context 'when format is json' do
|
||||||
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
|
||||||
|
|
||||||
subject(:body) { response.parsed_body }
|
subject(:body) { response.parsed_body }
|
||||||
|
|
||||||
|
let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
|
||||||
|
|
||||||
context 'with page' do
|
context 'with page' do
|
||||||
let(:page) { 1 }
|
let(:page) { 1 }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue