Autofix Rubocop RSpec/Capybara/FeatureMethods (#23708)

This commit is contained in:
Nick Schonning 2023-02-18 16:59:00 -05:00 committed by GitHub
parent 08289a38fa
commit c0d7c855b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 26 deletions

View file

@ -602,14 +602,6 @@ RSpec/BeforeAfterAll:
Exclude: Exclude:
- 'spec/requests/localization_spec.rb' - 'spec/requests/localization_spec.rb'
# Offense count: 14
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnabledMethods.
RSpec/Capybara/FeatureMethods:
Exclude:
- 'spec/features/log_in_spec.rb'
- 'spec/features/profile_spec.rb'
# Offense count: 558 # Offense count: 558
# Configuration parameters: Prefixes, AllowedPatterns. # Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without # Prefixes: when, with, without

View file

@ -2,21 +2,21 @@
require 'rails_helper' require 'rails_helper'
feature 'Log in' do describe 'Log in' do
include ProfileStories include ProfileStories
given(:email) { "test@example.com" } subject { page }
given(:password) { "password" }
given(:confirmed_at) { Time.zone.now }
background do let(:email) { "test@example.com" }
let(:password) { "password" }
let(:confirmed_at) { Time.zone.now }
before do
as_a_registered_user as_a_registered_user
visit new_user_session_path visit new_user_session_path
end end
subject { page } it 'A valid email and password user is able to log in' do
scenario 'A valid email and password user is able to log in' do
fill_in 'user_email', with: email fill_in 'user_email', with: email
fill_in 'user_password', with: password fill_in 'user_password', with: password
click_on I18n.t('auth.login') click_on I18n.t('auth.login')
@ -24,7 +24,7 @@ feature 'Log in' do
is_expected.to have_css('div.app-holder') is_expected.to have_css('div.app-holder')
end end
scenario 'A invalid email and password user is not able to log in' do it 'A invalid email and password user is not able to log in' do
fill_in 'user_email', with: 'invalid_email' fill_in 'user_email', with: 'invalid_email'
fill_in 'user_password', with: 'invalid_password' fill_in 'user_password', with: 'invalid_password'
click_on I18n.t('auth.login') click_on I18n.t('auth.login')
@ -33,9 +33,9 @@ feature 'Log in' do
end end
context do context do
given(:confirmed_at) { nil } let(:confirmed_at) { nil }
scenario 'A unconfirmed user is able to log in' do it 'A unconfirmed user is able to log in' do
fill_in 'user_email', with: email fill_in 'user_email', with: email
fill_in 'user_password', with: password fill_in 'user_password', with: password
click_on I18n.t('auth.login') click_on I18n.t('auth.login')

View file

@ -2,25 +2,25 @@
require 'rails_helper' require 'rails_helper'
feature 'Profile' do describe 'Profile' do
include ProfileStories include ProfileStories
given(:local_domain) { ENV['LOCAL_DOMAIN'] } subject { page }
background do let(:local_domain) { ENV['LOCAL_DOMAIN'] }
before do
as_a_logged_in_user as_a_logged_in_user
with_alice_as_local_user with_alice_as_local_user
end end
subject { page } it 'I can view Annes public account' do
scenario 'I can view Annes public account' do
visit account_path('alice') visit account_path('alice')
is_expected.to have_title("alice (@alice@#{local_domain})") is_expected.to have_title("alice (@alice@#{local_domain})")
end end
scenario 'I can change my account' do it 'I can change my account' do
visit settings_profile_path visit settings_profile_path
fill_in 'Display name', with: 'Bob' fill_in 'Display name', with: 'Bob'