|
|
|
@ -244,9 +244,26 @@ RSpec.describe Auth::RegistrationsController do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'does nothing if user already exists' do |
|
|
|
|
Fabricate(:account, username: 'test') |
|
|
|
|
subject |
|
|
|
|
context 'with an already taken username' do |
|
|
|
|
subject do |
|
|
|
|
Setting.registrations_mode = 'open' |
|
|
|
|
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Fabricate(:account, username: 'test') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'responds with an error message about the username' do |
|
|
|
|
subject |
|
|
|
|
|
|
|
|
|
expect(response).to have_http_status(:success) |
|
|
|
|
expect(username_error_text).to eq(I18n.t('errors.messages.taken')) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def username_error_text |
|
|
|
|
Nokogiri::Slop(response.body).css('.user_account_username .error').text |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
include_examples 'checks for enabled registrations', :create |
|
|
|
|