Fix rubocop offenses - Requires Ruby 3.1+
This commit is contained in:
@ -34,7 +34,7 @@ describe 'Authentication' do
|
||||
end
|
||||
|
||||
context 'with no authentication token' do
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user:) }
|
||||
let(:rfc_path) { request_for_comment_url(request_for_comment) }
|
||||
|
||||
it 'denies access to the request for comment' do
|
||||
@ -49,7 +49,7 @@ describe 'Authentication' do
|
||||
context 'with an authentication token' do
|
||||
let(:user) { create(:learner) }
|
||||
let(:study_group) { request_for_comment.submission.study_group }
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user:) }
|
||||
let(:commenting_user) { InternalUser.create(attributes_for(:teacher)) }
|
||||
let(:mail) { UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user) }
|
||||
let(:rfc_link) { request_for_comment_url(request_for_comment, token: token.shared_secret) }
|
||||
@ -57,7 +57,7 @@ describe 'Authentication' do
|
||||
before { allow(AuthenticationToken).to receive(:generate!).with(user, study_group).and_return(token).once }
|
||||
|
||||
context 'when the token is valid' do
|
||||
let(:token) { create(:authentication_token, user: user, study_group: study_group) }
|
||||
let(:token) { create(:authentication_token, user:, study_group:) }
|
||||
|
||||
it 'allows access to the request for comment' do
|
||||
mail.deliver_now
|
||||
@ -68,7 +68,7 @@ describe 'Authentication' do
|
||||
end
|
||||
|
||||
context 'with an expired authentication token' do
|
||||
let(:token) { create(:authentication_token, :invalid, user: user, study_group: study_group) }
|
||||
let(:token) { create(:authentication_token, :invalid, user:, study_group:) }
|
||||
|
||||
it 'denies access to the request for comment' do
|
||||
mail.deliver_now
|
||||
@ -81,7 +81,7 @@ describe 'Authentication' do
|
||||
end
|
||||
|
||||
context 'when the authentication token is used to login' do
|
||||
let(:token) { create(:authentication_token, user: user, study_group: study_group) }
|
||||
let(:token) { create(:authentication_token, user:, study_group:) }
|
||||
|
||||
it 'invalidates the token on login' do
|
||||
mail.deliver_now
|
||||
@ -108,14 +108,14 @@ describe 'Authentication' do
|
||||
end
|
||||
|
||||
context 'with an authentication token' do
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
|
||||
let(:request_for_comment) { create(:rfc_with_comment, user:) }
|
||||
let(:study_group) { request_for_comment.submission.study_group }
|
||||
let(:commenting_user) { InternalUser.create(attributes_for(:teacher)) }
|
||||
let(:mail) { UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user) }
|
||||
let(:rfc_link) { request_for_comment_url(request_for_comment, token: token.shared_secret) }
|
||||
|
||||
it 'still invalidates the token on login' do
|
||||
token = create(:authentication_token, user: user, study_group: study_group)
|
||||
token = create(:authentication_token, user:, study_group:)
|
||||
mail = UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user)
|
||||
mail.deliver_now
|
||||
visit(request_for_comment_url(request_for_comment, token: token.shared_secret))
|
||||
|
Reference in New Issue
Block a user