Fix RSpec/NoExpectationExample cop (#25103)

local
Matt Jankowski 12 months ago committed by GitHub
parent 38c6216082
commit 0f2c16ac4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .rubocop_todo.yml
  2. 23
      spec/controllers/auth/registrations_controller_spec.rb
  3. 2
      spec/services/precompute_feed_service_spec.rb

@ -528,13 +528,6 @@ RSpec/MultipleMemoizedHelpers:
RSpec/NestedGroups:
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:
Exclude:
- 'spec/models/account_spec.rb'

@ -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

@ -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
account = Fabricate(:account)
subject.call(account)
expect { subject.call(account) }.to_not raise_error
end
it 'filters statuses' do

Loading…
Cancel
Save