Fix RSpec/ContextWording cop (#24739)
This commit is contained in:
parent
cf18cc2891
commit
710745e16b
105 changed files with 559 additions and 668 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue