Address review comments from @nilsding

Co-authored-by: Georg Gadinger <nilsding@nilsding.org>
This commit is contained in:
Karina Kwiatek 2022-01-01 22:10:13 +01:00
parent 5a597fca5c
commit 9ce1fc0ce4
2 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ class ServicesController < ApplicationController
flash[:success] = t('flash.service.create.success') flash[:success] = t('flash.service.create.success')
else else
if service.errors.details.has_key?(:uid) && service.errors.details[:uid].any? { |err| err[:error] == :taken } if service.errors.details.has_key?(:uid) && service.errors.details[:uid].any? { |err| err[:error] == :taken }
flash[:error] = "The #{service.type.split('::').last.titleize} account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account." flash[:error] = "The #{service.type.split('::').last.titleize} account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account. If you are unable to disconnect the account yourself, please send us a Direct Message on Twitter: @retrospring."
else else
flash[:error] = t('flash.service.create.error') flash[:error] = t('flash.service.create.error')
end end

View File

@ -23,9 +23,9 @@ describe ServicesController, type: :controller do
subject { get :create, params: { provider: 'twitter' } } subject { get :create, params: { provider: 'twitter' } }
context 'no services connected' do context 'no services connected' do
it 'creates a service integration' do it 'creates a service integration' do
expect { subject }.to change { Service.count }.by(1) expect { subject }.to change { Service.count }.by(1)
end end
end end
context 'a user has a service connected' do context 'a user has a service connected' do
@ -34,7 +34,7 @@ describe ServicesController, type: :controller do
it 'shows an error when trying to attach a service account which is already connected' do it 'shows an error when trying to attach a service account which is already connected' do
subject subject
expect(flash[:error]).to eq("The Twitter account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account.") expect(flash[:error]).to eq("The Twitter account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account. If you are unable to disconnect the account yourself, please send us a Direct Message on Twitter: @retrospring.")
end end
end end
end end