Appease the reviewdog overlords

This commit is contained in:
Andreas Nedbal 2022-07-30 14:42:55 +02:00 committed by Andreas Nedbal
parent c131d3e024
commit 27eaef45ef
2 changed files with 11 additions and 11 deletions

View File

@ -23,7 +23,7 @@ class ApplicationController < ActionController::Base
if current_user.present? && current_user.banned?
name = current_user.screen_name
# obligatory '2001: A Space Odyssey' reference
flash[:notice] = t(".banned", name: name)
flash[:notice] = t(".banned", name:)
current_ban = current_user.bans.current.first
unless current_ban&.reason.nil?
flash[:notice] += "\n#{t('.reason', reason: current_ban.reason)}"

View File

@ -9,7 +9,7 @@ describe User::SessionsController do
end
describe "#create" do
let(:user) { FactoryBot.create(:user, password: '/bin/animals64') }
let(:user) { FactoryBot.create(:user, password: "/bin/animals64") }
subject { post :create, params: { user: { login: user.email, password: user.password } } }
@ -21,7 +21,7 @@ describe User::SessionsController do
user.otp_module = :enabled
user.save
expect(subject).to have_rendered('auth/two_factor_authentication')
expect(subject).to have_rendered("auth/two_factor_authentication")
end
context "2fa sign in attempt" do
@ -53,10 +53,10 @@ describe User::SessionsController do
end
context "correct recovery code" do
let(:code_input) { 'raccoons' }
let(:code_input) { "raccoons" }
before do
user.totp_recovery_codes << TotpRecoveryCode.create(code: 'raccoons')
user.totp_recovery_codes << TotpRecoveryCode.create(code: "raccoons")
end
it "consumes the recovery code" do
@ -66,7 +66,7 @@ describe User::SessionsController do
end
context "incorrect recovery code" do
let(:code_input) { 'abcdefgh' }
let(:code_input) { "abcdefgh" }
it "redirects to the sign in page" do
expect(subject).to redirect_to :new_user_session
@ -82,7 +82,7 @@ describe User::SessionsController do
it "redirects to the sign in page" do
expect(subject).to redirect_to :new_user_session
expect(flash[:notice]).to eq "#{I18n.t("user.sessions.create.banned", name: user.screen_name)}\n#{I18n.t("user.sessions.create.reason", reason: 'Do not feed the animals')}"
expect(flash[:notice]).to eq "#{I18n.t('user.sessions.create.banned', name: user.screen_name)}\n#{I18n.t('user.sessions.create.reason', reason: 'Do not feed the animals')}"
end
end
@ -96,8 +96,8 @@ describe User::SessionsController do
it "redirects to the sign in page" do
expect(subject).to redirect_to :new_user_session
expect(flash[:notice]).to eq I18n.t("user.sessions.create.banned", name: user.screen_name) +
"\n#{I18n.t("user.sessions.create.reason", reason: 'Do not feed the animals')}" \
"\n#{I18n.t("user.sessions.create.until", time: expiry)}"
"\n#{I18n.t('user.sessions.create.reason', reason: 'Do not feed the animals')}" \
"\n#{I18n.t('user.sessions.create.until', time: expiry)}"
end
end
end