mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 09:08:24 +00:00
Fix RSpec/NoExpectationExample cop (#25103)
This commit is contained in:
parent
38c6216082
commit
0f2c16ac4b
|
@ -528,13 +528,6 @@ RSpec/MultipleMemoizedHelpers:
|
||||||
RSpec/NestedGroups:
|
RSpec/NestedGroups:
|
||||||
Max: 6
|
Max: 6
|
||||||
|
|
||||||
# Configuration parameters: AllowedPatterns.
|
|
||||||
# AllowedPatterns: ^expect_, ^assert_
|
|
||||||
RSpec/NoExpectationExample:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/auth/registrations_controller_spec.rb'
|
|
||||||
- 'spec/services/precompute_feed_service_spec.rb'
|
|
||||||
|
|
||||||
RSpec/PendingWithoutReason:
|
RSpec/PendingWithoutReason:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/models/account_spec.rb'
|
- 'spec/models/account_spec.rb'
|
||||||
|
|
|
@ -244,9 +244,26 @@ RSpec.describe Auth::RegistrationsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does nothing if user already exists' do
|
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')
|
Fabricate(:account, username: 'test')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'responds with an error message about the username' do
|
||||||
subject
|
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
|
end
|
||||||
|
|
||||||
include_examples 'checks for enabled registrations', :create
|
include_examples 'checks for enabled registrations', :create
|
||||||
|
|
|
@ -19,7 +19,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
|
||||||
|
|
||||||
it 'does not raise an error even if it could not find any status' do
|
it 'does not raise an error even if it could not find any status' do
|
||||||
account = Fabricate(:account)
|
account = Fabricate(:account)
|
||||||
subject.call(account)
|
expect { subject.call(account) }.to_not raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'filters statuses' do
|
it 'filters statuses' do
|
||||||
|
|
Loading…
Reference in a new issue