Fix RSpec/ContextWording cop (#24739)
This commit is contained in:
parent
cf18cc2891
commit
710745e16b
105 changed files with 559 additions and 668 deletions
|
@ -57,7 +57,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it_behaves_like 'preliminary checks'
|
||||
|
@ -140,7 +140,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:authorized_fetch_mode) { false }
|
||||
let(:format) { 'json' }
|
||||
|
||||
|
@ -193,7 +193,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
expect(json).to include(:id, :type, :preferredUsername, :inbox, :publicKey, :name, :summary)
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { true }
|
||||
|
||||
it 'returns http unauthorized' do
|
||||
|
@ -251,7 +251,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
expect(json).to include(:id, :type, :preferredUsername, :inbox, :publicKey, :name, :summary)
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
let(:authorized_fetch_mode) { true }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -278,7 +278,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as RSS' do
|
||||
context 'with RSS' do
|
||||
let(:format) { 'rss' }
|
||||
|
||||
it_behaves_like 'preliminary checks'
|
||||
|
|
|
@ -119,7 +119,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'in authorized fetch mode' do
|
||||
context 'with authorized fetch mode' do
|
||||
before do
|
||||
allow(controller).to receive(:authorized_fetch_mode?).and_return(true)
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do
|
|||
expect(response).to have_http_status(202)
|
||||
end
|
||||
|
||||
context 'for a specific account' do
|
||||
context 'with a specific account' do
|
||||
subject(:response) { post :create, params: { account_username: account.username }, body: '{}' }
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
|
|
@ -83,7 +83,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
|
|||
BlockDomainService.new.call(domain_block)
|
||||
end
|
||||
|
||||
context 'downgrading a domain suspension to silence' do
|
||||
context 'when downgrading a domain suspension to silence' do
|
||||
let(:original_severity) { 'suspend' }
|
||||
let(:new_severity) { 'silence' }
|
||||
|
||||
|
@ -100,7 +100,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'upgrading a domain silence to suspend' do
|
||||
context 'when upgrading a domain silence to suspend' do
|
||||
let(:original_severity) { 'silence' }
|
||||
let(:new_severity) { 'suspend' }
|
||||
|
||||
|
|
|
@ -146,13 +146,13 @@ describe Admin::Reports::ActionsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'action as submit button' do
|
||||
context 'with Action as submit button' do
|
||||
subject { post :create, params: common_params.merge({ action => '' }) }
|
||||
|
||||
it_behaves_like 'all action types'
|
||||
end
|
||||
|
||||
context 'action as submit button' do
|
||||
context 'with Action as submit button' do
|
||||
subject { post :create, params: common_params.merge({ moderation_action: action }) }
|
||||
|
||||
it_behaves_like 'all action types'
|
||||
|
|
|
@ -30,7 +30,7 @@ describe Admin::StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'filtering by media' do
|
||||
context 'when filtering by media' do
|
||||
before do
|
||||
get :index, params: { account_id: account.id, media: '1' }
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ describe Api::V1::Accounts::RelationshipsController do
|
|||
lewis.follow!(user.account)
|
||||
end
|
||||
|
||||
context 'provided only one ID' do
|
||||
context 'when provided only one ID' do
|
||||
before do
|
||||
get :index, params: { id: simon.id }
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ describe Api::V1::Accounts::RelationshipsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'provided multiple IDs' do
|
||||
context 'when provided multiple IDs' do
|
||||
before do
|
||||
get :index, params: { id: [simon.id, lewis.id] }
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
post :create, params: { username: 'test', password: '12345678', email: 'hello@world.tld', agreement: agreement }
|
||||
end
|
||||
|
||||
context 'given truthy agreement' do
|
||||
context 'when given truthy agreement' do
|
||||
let(:agreement) { 'true' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -48,7 +48,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'given no agreement' do
|
||||
context 'when given no agreement' do
|
||||
it 'returns http unprocessable entity' do
|
||||
expect(response).to have_http_status(422)
|
||||
end
|
||||
|
@ -121,7 +121,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'modifying follow options' do
|
||||
context 'when modifying follow options' do
|
||||
let(:locked) { false }
|
||||
|
||||
before do
|
||||
|
|
|
@ -84,7 +84,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
|
|||
BlockDomainService.new.call(domain_block)
|
||||
end
|
||||
|
||||
context 'downgrading a domain suspension to silence' do
|
||||
context 'when downgrading a domain suspension to silence' do
|
||||
let(:original_severity) { 'suspend' }
|
||||
let(:new_severity) { 'silence' }
|
||||
|
||||
|
@ -101,7 +101,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'upgrading a domain silence to suspend' do
|
||||
context 'when upgrading a domain silence to suspend' do
|
||||
let(:original_severity) { 'silence' }
|
||||
let(:new_severity) { 'suspend' }
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
|||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
end
|
||||
|
||||
context 'from a random app' do
|
||||
context 'when from a random app' do
|
||||
it 'returns http forbidden' do
|
||||
post :create
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
|
||||
context 'from an app that created the account' do
|
||||
context 'when from an app that created the account' do
|
||||
before do
|
||||
user.update(created_by_application: token.application)
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
|||
expect(response).to have_http_status(403)
|
||||
end
|
||||
|
||||
context 'but user changed e-mail and has not confirmed it' do
|
||||
context 'with user changed e-mail and has not confirmed it' do
|
||||
before do
|
||||
user.update(email: 'foo@bar.com')
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe Api::V1::Instances::ActivityController, type: :controller do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
context '!Setting.activity_api_enabled' do
|
||||
context 'with !Setting.activity_api_enabled' do
|
||||
it 'returns 404' do
|
||||
Setting.activity_api_enabled = false
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe Api::V1::Instances::PeersController, type: :controller do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
context '!Setting.peers_api_enabled' do
|
||||
context 'with !Setting.peers_api_enabled' do
|
||||
it 'returns 404' do
|
||||
Setting.peers_api_enabled = false
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'image/jpeg' do
|
||||
context 'with image/jpeg' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'image/gif' do
|
||||
context 'with image/gif' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.gif', 'image/gif') }
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'video/webm' do
|
||||
context 'with video/webm' do
|
||||
before do
|
||||
post :create, params: { file: fixture_file_upload('attachment.webm', 'video/webm') }
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
|
|||
let!(:filter) { Fabricate(:custom_filter, account: user.account) }
|
||||
let!(:keyword) { Fabricate(:custom_filter_keyword, custom_filter: filter) }
|
||||
|
||||
context 'updating filter parameters' do
|
||||
context 'when updating filter parameters' do
|
||||
before do
|
||||
put :update, params: { id: filter.id, title: 'updated', context: %w(home public) }
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'updating keywords in bulk' do
|
||||
context 'when updating keywords in bulk' do
|
||||
before do
|
||||
allow(redis).to receive_messages(publish: nil)
|
||||
put :update, params: { id: filter.id, keywords_attributes: [{ id: keyword.id, keyword: 'updated' }] }
|
||||
|
|
|
@ -32,7 +32,7 @@ describe ApplicationController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'forgery' do
|
||||
context 'with a forgery' do
|
||||
subject do
|
||||
ActionController::Base.allow_forgery_protection = true
|
||||
routes.draw { post 'success' => 'anonymous#success' }
|
||||
|
@ -105,7 +105,7 @@ describe ApplicationController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'ActionController::RoutingError' do
|
||||
context 'with ActionController::RoutingError' do
|
||||
subject do
|
||||
routes.draw { get 'routing_error' => 'anonymous#routing_error' }
|
||||
get 'routing_error'
|
||||
|
@ -114,7 +114,7 @@ describe ApplicationController, type: :controller do
|
|||
include_examples 'respond_with_error', 404
|
||||
end
|
||||
|
||||
context 'ActiveRecord::RecordNotFound' do
|
||||
context 'with ActiveRecord::RecordNotFound' do
|
||||
subject do
|
||||
routes.draw { get 'record_not_found' => 'anonymous#record_not_found' }
|
||||
get 'record_not_found'
|
||||
|
@ -123,7 +123,7 @@ describe ApplicationController, type: :controller do
|
|||
include_examples 'respond_with_error', 404
|
||||
end
|
||||
|
||||
context 'ActionController::InvalidAuthenticityToken' do
|
||||
context 'with ActionController::InvalidAuthenticityToken' do
|
||||
subject do
|
||||
routes.draw { get 'invalid_authenticity_token' => 'anonymous#invalid_authenticity_token' }
|
||||
get 'invalid_authenticity_token'
|
||||
|
@ -252,7 +252,7 @@ describe ApplicationController, type: :controller do
|
|||
expect(subject.new.cache_collection(raw, Object)).to eq raw
|
||||
end
|
||||
|
||||
context 'Status' do
|
||||
context 'with a Status' do
|
||||
include_examples 'cacheable', :status, Status
|
||||
end
|
||||
end
|
||||
|
|
|
@ -157,7 +157,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations without invite' do
|
||||
context 'with Approval-based registrations without invite' do
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
|
@ -184,7 +184,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations with expired invite' do
|
||||
context 'with Approval-based registrations with expired invite' do
|
||||
subject do
|
||||
Setting.registrations_mode = 'approved'
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
|
@ -212,7 +212,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'approval-based registrations with valid invite and required invite text' do
|
||||
context 'with Approval-based registrations with valid invite and required invite text' do
|
||||
subject do
|
||||
inviter = Fabricate(:user, confirmed_at: 2.days.ago)
|
||||
Setting.registrations_mode = 'approved'
|
||||
|
|
|
@ -51,8 +51,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
|
||||
context 'using a valid password' do
|
||||
context 'when using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
|
||||
context 'when using a valid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: 'pam_user1', password: '123456' } }
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using an invalid password' do
|
||||
context 'when using an invalid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: 'pam_user1', password: 'WRONGPW' } }
|
||||
end
|
||||
|
@ -80,7 +80,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using a valid email and existing user' do
|
||||
context 'when using a valid email and existing user' do
|
||||
let!(:user) do
|
||||
account = Fabricate.build(:account, username: 'pam_user1', user: nil)
|
||||
account.save!(validate: false)
|
||||
|
@ -102,10 +102,10 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using password authentication' do
|
||||
context 'when using password authentication' do
|
||||
let(:user) { Fabricate(:user, email: 'foo@bar.com', password: 'abcdefgh') }
|
||||
|
||||
context 'using a valid password' do
|
||||
context 'when using a valid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
@ -119,7 +119,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using a valid password on a previously-used account with a new IP address' do
|
||||
context 'when using a valid password on a previously-used account with a new IP address' do
|
||||
let(:previous_ip) { '1.2.3.4' }
|
||||
let(:current_ip) { '4.3.2.1' }
|
||||
|
||||
|
@ -145,7 +145,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using email with uppercase letters' do
|
||||
context 'when using email with uppercase letters' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
|
@ -159,7 +159,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using an invalid password' do
|
||||
context 'when using an invalid password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: 'wrongpw' } }
|
||||
end
|
||||
|
@ -173,7 +173,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using an unconfirmed password' do
|
||||
context 'when using an unconfirmed password' do
|
||||
before do
|
||||
request.headers['Accept-Language'] = accept_language
|
||||
post :create, params: { user: { email: unconfirmed_user.email, password: unconfirmed_user.password } }
|
||||
|
@ -187,14 +187,14 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context "logging in from the user's page" do
|
||||
context "when logging in from the user's page" do
|
||||
before do
|
||||
allow(controller).to receive(:single_user_mode?).and_return(single_user_mode)
|
||||
allow(controller).to receive(:stored_location_for).with(:user).and_return("/@#{user.account.username}")
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
||||
context 'in single user mode' do
|
||||
context 'with single user mode' do
|
||||
let(:single_user_mode) { true }
|
||||
|
||||
it 'redirects to home' do
|
||||
|
@ -202,7 +202,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'in non-single user mode' do
|
||||
context 'with non-single user mode' do
|
||||
let(:single_user_mode) { false }
|
||||
|
||||
it "redirects back to the user's page" do
|
||||
|
@ -212,7 +212,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using two-factor authentication' do
|
||||
context 'when using two-factor authentication' do
|
||||
context 'with OTP enabled as second factor' do
|
||||
let!(:user) do
|
||||
Fabricate(:user, email: 'x@y.com', password: 'abcdefgh', otp_required_for_login: true, otp_secret: User.generate_otp_secret(32))
|
||||
|
@ -224,7 +224,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
return codes
|
||||
end
|
||||
|
||||
context 'using email and password' do
|
||||
context 'when using email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
@ -235,7 +235,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using email and password after an unfinished log-in attempt to a 2FA-protected account' do
|
||||
context 'when using email and password after an unfinished log-in attempt to a 2FA-protected account' do
|
||||
let!(:other_user) do
|
||||
Fabricate(:user, email: 'z@y.com', password: 'abcdefgh', otp_required_for_login: true, otp_secret: User.generate_otp_secret(32))
|
||||
end
|
||||
|
@ -251,7 +251,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using upcase email and password' do
|
||||
context 'when using upcase email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
|
@ -262,7 +262,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using a valid OTP' do
|
||||
context 'when using a valid OTP' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
|
@ -291,7 +291,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using a valid recovery code' do
|
||||
context 'when using a valid recovery code' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: recovery_codes.first } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
|
@ -305,7 +305,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using an invalid OTP' do
|
||||
context 'when using an invalid OTP' do
|
||||
before do
|
||||
post :create, params: { user: { otp_attempt: 'wrongotp' } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s }
|
||||
end
|
||||
|
@ -353,7 +353,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
|
||||
let(:fake_credential) { fake_client.get(challenge: challenge, sign_count: sign_count) }
|
||||
|
||||
context 'using email and password' do
|
||||
context 'when using email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email, password: user.password } }
|
||||
end
|
||||
|
@ -364,7 +364,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using upcase email and password' do
|
||||
context 'when using upcase email and password' do
|
||||
before do
|
||||
post :create, params: { user: { email: user.email.upcase, password: user.password } }
|
||||
end
|
||||
|
@ -375,7 +375,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using a valid webauthn credential' do
|
||||
context 'when using a valid webauthn credential' do
|
||||
before do
|
||||
@controller.session[:webauthn_challenge] = challenge
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ RSpec.describe CacheConcern, type: :controller do
|
|||
end
|
||||
|
||||
describe '#cache_collection' do
|
||||
context 'given an empty array' do
|
||||
context 'when given an empty array' do
|
||||
it 'returns an empty array' do
|
||||
get :empty_array
|
||||
expect(response.body).to eq '0'
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an empty relation' do
|
||||
context 'when given an empty relation' do
|
||||
it 'returns an empty array' do
|
||||
get :empty_relation
|
||||
expect(response.body).to eq '0'
|
||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo }
|
||||
|
||||
it 'does not ask for password' do
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar }
|
||||
|
||||
it 'does not ask for password' do
|
||||
|
@ -56,7 +56,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo, session: { challenge_passed_at: Time.now.utc } }
|
||||
|
||||
it 'does not ask for password' do
|
||||
|
@ -64,7 +64,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar, session: { challenge_passed_at: Time.now.utc } }
|
||||
|
||||
it 'does not ask for password' do
|
||||
|
@ -81,7 +81,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
context 'for GET requests' do
|
||||
context 'with GET requests' do
|
||||
before { get :foo }
|
||||
|
||||
it 'renders challenge' do
|
||||
|
@ -91,7 +91,7 @@ RSpec.describe ChallengableConcern, type: :controller do
|
|||
# See Auth::ChallengesControllerSpec
|
||||
end
|
||||
|
||||
context 'for POST requests' do
|
||||
context 'with POST requests' do
|
||||
before { post :bar }
|
||||
|
||||
it 'renders challenge' do
|
||||
|
|
|
@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'user with valid locale has signed in' do
|
||||
context 'with a user with valid locale has signed in' do
|
||||
it "sets user's locale" do
|
||||
user = Fabricate(:user, locale: :ca)
|
||||
|
||||
|
@ -52,7 +52,7 @@ describe ApplicationController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'user with invalid locale has signed in' do
|
||||
context 'with a user with invalid locale has signed in' do
|
||||
before do
|
||||
user = Fabricate.build(:user, locale: :invalid)
|
||||
user.save!(validate: false)
|
||||
|
@ -62,7 +62,7 @@ describe ApplicationController, type: :controller do
|
|||
include_examples 'default locale'
|
||||
end
|
||||
|
||||
context 'user has not signed in' do
|
||||
context 'with a user who has not signed in' do
|
||||
include_examples 'default locale'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe ApplicationController do
|
|||
end
|
||||
|
||||
describe 'rate limiting' do
|
||||
context 'throttling is off' do
|
||||
context 'when throttling is off' do
|
||||
before do
|
||||
request.env['rack.attack.throttle_data'] = nil
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ describe ApplicationController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'throttling is on' do
|
||||
context 'when throttling is on' do
|
||||
let(:start_time) { DateTime.new(2017, 1, 1, 12, 0, 0).utc }
|
||||
|
||||
before do
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe InstanceActorsController, type: :controller do
|
||||
describe 'GET #show' do
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
shared_examples 'shared behavior' do
|
||||
|
|
|
@ -50,7 +50,7 @@ describe Settings::ApplicationsController do
|
|||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'success (passed scopes as a String)' do
|
||||
context 'when success (passed scopes as a String)' do
|
||||
def call_create
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
|
@ -72,7 +72,7 @@ describe Settings::ApplicationsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'success (passed scopes as an Array)' do
|
||||
context 'when success (passed scopes as an Array)' do
|
||||
def call_create
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
|
@ -94,7 +94,7 @@ describe Settings::ApplicationsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'failure' do
|
||||
context 'with failure request' do
|
||||
before do
|
||||
post :create, params: {
|
||||
doorkeeper_application: {
|
||||
|
@ -117,7 +117,7 @@ describe Settings::ApplicationsController do
|
|||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
context 'success' do
|
||||
context 'when success' do
|
||||
let(:opts) do
|
||||
{
|
||||
website: 'https://foo.bar/',
|
||||
|
@ -142,7 +142,7 @@ describe Settings::ApplicationsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'failure' do
|
||||
context 'with failure request' do
|
||||
before do
|
||||
patch :update, params: {
|
||||
id: app.id,
|
||||
|
|
|
@ -275,7 +275,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
|
|||
end
|
||||
|
||||
context 'when user have not enabled webauthn' do
|
||||
context 'creation succeeds' do
|
||||
context 'when creation succeeds' do
|
||||
it 'creates a webauthn credential' do
|
||||
@controller.session[:webauthn_challenge] = challenge
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -97,7 +97,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -132,7 +132,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -140,7 +140,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -156,7 +156,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -164,7 +164,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -196,7 +196,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -221,7 +221,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -260,7 +260,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -285,7 +285,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -320,7 +320,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -328,7 +328,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -347,7 +347,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -372,7 +372,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -407,7 +407,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -415,7 +415,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -460,7 +460,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -485,7 +485,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -522,7 +522,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -547,7 +547,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -582,7 +582,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -590,7 +590,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -609,7 +609,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -634,7 +634,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http success' do
|
||||
|
@ -669,7 +669,7 @@ describe StatusesController do
|
|||
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
||||
end
|
||||
|
||||
context 'as JSON' do
|
||||
context 'with JSON' do
|
||||
let(:format) { 'json' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
@ -677,7 +677,7 @@ describe StatusesController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as HTML' do
|
||||
context 'with HTML' do
|
||||
let(:format) { 'html' }
|
||||
|
||||
it 'returns http not found' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue