Update rubocop-capybara to version 2.23.0 (#38868)

This commit is contained in:
Matt Jankowski 2026-05-04 03:52:29 -04:00 committed by GitHub
parent e4b8bbe6e8
commit 696aaa616b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
61 changed files with 194 additions and 194 deletions

View File

@ -770,9 +770,9 @@ GEM
rubocop-ast (1.49.1)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-capybara (2.22.1)
rubocop-capybara (2.23.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop (~> 1.81)
rubocop-i18n (3.3.0)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)

View File

@ -19,7 +19,7 @@ RSpec.describe 'Admin Account Actions' do
expect { submit_form }
.to_not(change { account.strikes.count })
expect(page)
.to have_content(/can't be blank/)
.to have_text(/can't be blank/)
# Valid submission
choose(option: 'silence')

View File

@ -16,18 +16,18 @@ RSpec.describe 'Admin::AccountModerationNotes' do
expect { submit_form }
.to not_change(AccountModerationNote, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
fill_in 'account_moderation_note_content', with: 'Test message'
expect { submit_form }
.to change(AccountModerationNote, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.account_moderation_notes.created_msg'))
.to have_text(I18n.t('admin.account_moderation_notes.created_msg'))
expect { delete_note }
.to change(AccountModerationNote, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.account_moderation_notes.destroyed_msg'))
.to have_text(I18n.t('admin.account_moderation_notes.destroyed_msg'))
end
def submit_form

View File

@ -24,7 +24,7 @@ RSpec.describe 'Admin::Accounts' do
it 'displays a notice about account selection' do
click_on button_for_suspend
expect(page).to have_content(selection_error_text)
expect(page).to have_text(selection_error_text)
end
end

View File

@ -13,7 +13,7 @@ RSpec.describe 'Admin::Announcements' do
within css_id(announcement) do
expect(page)
.to have_content(announcement.text)
.to have_text(announcement.text)
end
end
end
@ -29,7 +29,7 @@ RSpec.describe 'Admin::Announcements' do
expect { submit_form }
.to change(Announcement, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.announcements.published_msg'))
.to have_text(I18n.t('admin.announcements.published_msg'))
end
end
@ -48,7 +48,7 @@ RSpec.describe 'Admin::Announcements' do
click_on submit_button
expect(page)
.to have_content(I18n.t('admin.announcements.updated_msg'))
.to have_text(I18n.t('admin.announcements.updated_msg'))
end
end
@ -62,7 +62,7 @@ RSpec.describe 'Admin::Announcements' do
.to change(Announcement, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.announcements.destroyed_msg'))
.to have_text(I18n.t('admin.announcements.destroyed_msg'))
end
end
@ -76,7 +76,7 @@ RSpec.describe 'Admin::Announcements' do
.to change { announcement.reload.published? }.to(true)
expect(page)
.to have_content(I18n.t('admin.announcements.published_msg'))
.to have_text(I18n.t('admin.announcements.published_msg'))
end
it 'unpublishes an existing announcement' do
@ -88,7 +88,7 @@ RSpec.describe 'Admin::Announcements' do
.to change { announcement.reload.published? }.to(false)
expect(page)
.to have_content(I18n.t('admin.announcements.unpublished_msg'))
.to have_text(I18n.t('admin.announcements.unpublished_msg'))
end
end

View File

@ -40,7 +40,7 @@ RSpec.describe 'Admin Confirmations' do
.to send_email(to: user.email)
expect(page)
.to have_title(I18n.t('admin.accounts.title'))
.and have_content(I18n.t('admin.accounts.resend_confirmation.success'))
.and have_text(I18n.t('admin.accounts.resend_confirmation.success'))
end
end

View File

@ -14,8 +14,8 @@ RSpec.describe 'Admin::CustomEmojis' do
visit admin_custom_emojis_path
expect(page)
.to have_content(I18n.t('admin.custom_emojis.title'))
.and have_content(custom_emoji.shortcode)
.to have_text(I18n.t('admin.custom_emojis.title'))
.and have_text(custom_emoji.shortcode)
end
end
@ -23,12 +23,12 @@ RSpec.describe 'Admin::CustomEmojis' do
it 'saves a new emoji record with valid attributes' do
visit new_admin_custom_emoji_path
expect(page)
.to have_content(I18n.t('admin.custom_emojis.title'))
.to have_text(I18n.t('admin.custom_emojis.title'))
expect { submit_form }
.to_not change(CustomEmoji, :count)
expect(page)
.to have_content(/errors below/)
.to have_text(/errors below/)
fill_in I18n.t('admin.custom_emojis.shortcode'),
with: 'test'
@ -53,7 +53,7 @@ RSpec.describe 'Admin::CustomEmojis' do
it 'displays a notice about selection' do
click_on button_for_enable
expect(page).to have_content(selection_error_text)
expect(page).to have_text(selection_error_text)
end
end

View File

@ -18,8 +18,8 @@ RSpec.describe 'Admin Dashboard' do
expect(page)
.to have_title(I18n.t('admin.dashboard.title'))
.and have_content(I18n.t('admin.system_checks.software_version_patch_check.message_html'))
.and have_content('0 pending hashtags')
.and have_text(I18n.t('admin.system_checks.software_version_patch_check.message_html'))
.and have_text('0 pending hashtags')
end
private

View File

@ -27,28 +27,28 @@ RSpec.describe 'Admin::DomainAllows' do
visit new_admin_domain_allow_path
click_on I18n.t('admin.domain_allows.add_new')
expect(page)
.to have_content(I18n.t('admin.domain_allows.add_new'))
.to have_text(I18n.t('admin.domain_allows.add_new'))
# Submit invalid with missing domain
fill_in 'domain_allow_domain', with: ''
expect { submit_form }
.to not_change(DomainAllow, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
# Submit valid with domain present
fill_in 'domain_allow_domain', with: domain
expect { submit_form }
.to change(DomainAllow, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.domain_allows.created_msg'))
.to have_text(I18n.t('admin.domain_allows.created_msg'))
# Visit instance page and delete the domain allow
visit admin_instance_path(domain)
expect { delete_domain_allow }
.to change(DomainAllow, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.domain_allows.destroyed_msg'))
.to have_text(I18n.t('admin.domain_allows.destroyed_msg'))
end
def submit_form

View File

@ -66,7 +66,7 @@ RSpec.describe 'blocking domains through the moderation interface' do
submit_domain_block('example.com', 'noop')
expect(page)
.to have_content(/You have already imposed stricter limits on example.com/)
.to have_text(/You have already imposed stricter limits on example.com/)
end
end
@ -77,7 +77,7 @@ RSpec.describe 'blocking domains through the moderation interface' do
submit_domain_block('', 'noop')
expect(page)
.to have_content(/review the error below/)
.to have_text(/review the error below/)
end
end

View File

@ -15,24 +15,24 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
it 'views and creates new blocks' do
visit admin_email_domain_blocks_path
expect(page)
.to have_content(I18n.t('admin.email_domain_blocks.title'))
.and have_content(email_domain_block.domain)
.to have_text(I18n.t('admin.email_domain_blocks.title'))
.and have_text(email_domain_block.domain)
click_on I18n.t('admin.email_domain_blocks.add_new')
expect(page)
.to have_content(I18n.t('admin.email_domain_blocks.new.title'))
.to have_text(I18n.t('admin.email_domain_blocks.new.title'))
fill_in I18n.t('admin.email_domain_blocks.domain'), with: 'example.com'
expect { submit_resolve }
.to_not change(EmailDomainBlock, :count)
expect(page)
.to have_content(I18n.t('admin.email_domain_blocks.new.title'))
.to have_text(I18n.t('admin.email_domain_blocks.new.title'))
expect { submit_create }
.to change(EmailDomainBlock.where(domain: 'example.com'), :count).by(1)
expect(page)
.to have_content(I18n.t('admin.email_domain_blocks.title'))
.and have_content(I18n.t('admin.email_domain_blocks.created_msg'))
.to have_text(I18n.t('admin.email_domain_blocks.title'))
.and have_text(I18n.t('admin.email_domain_blocks.created_msg'))
end
def submit_resolve
@ -53,7 +53,7 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
it 'displays a notice about selection' do
click_on button_for_delete
expect(page).to have_content(selection_error_text)
expect(page).to have_text(selection_error_text)
end
end

View File

@ -12,7 +12,7 @@ RSpec.describe 'Admin Follow Recommendations' do
visit admin_follow_recommendations_path
expect(page)
.to have_content(I18n.t('admin.follow_recommendations.title'))
.to have_text(I18n.t('admin.follow_recommendations.title'))
end
end
end

View File

@ -16,13 +16,13 @@ RSpec.describe 'Admin::Instances::ModerationNotesController' do
expect { submit_form }
.to not_change(InstanceModerationNote, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
fill_in 'instance_moderation_note_content', with: 'Test message ' * InstanceModerationNote::CONTENT_SIZE_LIMIT
expect { submit_form }
.to not_change(InstanceModerationNote, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
fill_in 'instance_moderation_note_content', with: 'Test message'
expect { submit_form }
@ -30,12 +30,12 @@ RSpec.describe 'Admin::Instances::ModerationNotesController' do
expect(page)
.to have_current_path(admin_instance_path(instance_domain))
expect(page)
.to have_content(I18n.t('admin.instances.moderation_notes.created_msg'))
.to have_text(I18n.t('admin.instances.moderation_notes.created_msg'))
expect { delete_note }
.to change(InstanceModerationNote, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.instances.moderation_notes.destroyed_msg'))
.to have_text(I18n.t('admin.instances.moderation_notes.destroyed_msg'))
end
def submit_form

View File

@ -12,7 +12,7 @@ RSpec.describe 'Admin::IpBlocks' do
# Visit index page
visit admin_ip_blocks_path
expect(page)
.to have_content(I18n.t('admin.ip_blocks.title'))
.to have_text(I18n.t('admin.ip_blocks.title'))
# Navigate to new
click_on I18n.t('admin.ip_blocks.add_new')
@ -22,14 +22,14 @@ RSpec.describe 'Admin::IpBlocks' do
expect { submit_form }
.to_not change(IpBlock, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
# Valid with IP
fill_in 'ip_block_ip', with: '192.168.1.1'
expect { submit_form }
.to change(IpBlock, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.ip_blocks.created_msg'))
.to have_text(I18n.t('admin.ip_blocks.created_msg'))
end
def submit_form
@ -44,7 +44,7 @@ RSpec.describe 'Admin::IpBlocks' do
click_on button_for_delete
expect(page)
.to have_content(selection_error_text)
.to have_text(selection_error_text)
end
end

View File

@ -13,8 +13,8 @@ RSpec.describe 'Admin Relays' do
visit admin_relays_path
expect(page)
.to have_content(I18n.t('admin.relays.title'))
.and have_content(relay.inbox_url)
.to have_text(I18n.t('admin.relays.title'))
.and have_text(relay.inbox_url)
end
end
@ -25,21 +25,21 @@ RSpec.describe 'Admin Relays' do
# Visit new page
click_on I18n.t('admin.relays.setup')
expect(page)
.to have_content(I18n.t('admin.relays.add_new'))
.to have_text(I18n.t('admin.relays.add_new'))
# Invalid submission
fill_in 'relay_inbox_url', with: ''
expect { submit_form }
.to_not change(Relay, :count)
expect(page)
.to have_content(/errors below/)
.to have_text(/errors below/)
# Valid submission
fill_in 'relay_inbox_url', with: 'https://host.example/hooks/123'
expect { submit_form }
.to change(Relay, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.relays.title'))
.to have_text(I18n.t('admin.relays.title'))
end
def submit_form

View File

@ -21,7 +21,7 @@ RSpec.describe 'Admin Report Notes' do
expect(report.reload)
.to be_action_taken
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def submit_form
@ -39,7 +39,7 @@ RSpec.describe 'Admin Report Notes' do
expect(report.reload)
.to_not be_action_taken
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def submit_form
@ -61,7 +61,7 @@ RSpec.describe 'Admin Report Notes' do
expect(report.reload)
.to_not be_action_taken
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def submit_form
@ -79,7 +79,7 @@ RSpec.describe 'Admin Report Notes' do
expect(report.reload)
.to be_action_taken
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def submit_form
@ -98,7 +98,7 @@ RSpec.describe 'Admin Report Notes' do
expect { submit_form }
.to_not change(ReportNote, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
end
def submit_form
@ -120,7 +120,7 @@ RSpec.describe 'Admin Report Notes' do
expect { delete_note }
.to change(ReportNote, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.report_notes.destroyed_msg'))
.to have_text(I18n.t('admin.report_notes.destroyed_msg'))
end
def delete_note

View File

@ -16,19 +16,19 @@ RSpec.describe 'Admin Reports' do
visit admin_reports_path
expect(page)
.to have_content(unresolved_report.comment)
.and have_no_content(resolved_report.comment)
.to have_text(unresolved_report.comment)
.and have_no_text(resolved_report.comment)
click_on I18n.t('admin.reports.resolved')
expect(page)
.to have_content(resolved_report.comment)
.and have_no_content(unresolved_report.comment)
.to have_text(resolved_report.comment)
.and have_no_text(unresolved_report.comment)
click_on resolved_report.comment
expect(page)
.to have_title(I18n.t('admin.reports.report', id: resolved_report.id))
.and have_content(resolved_report.comment)
.and have_content(report_note.content)
.and have_text(resolved_report.comment)
.and have_text(report_note.content)
end
end
@ -43,7 +43,7 @@ RSpec.describe 'Admin Reports' do
expect(page)
.to have_title(I18n.t('admin.reports.title'))
.and have_content(I18n.t('admin.reports.resolved_msg'))
.and have_text(I18n.t('admin.reports.resolved_msg'))
report.reload
expect(report.action_taken_by_account)

View File

@ -15,7 +15,7 @@ RSpec.describe 'Admin::Reset' do
end.to change(Admin::ActionLog.where(target: account.user), :count).by(1)
expect(page)
.to have_content(account.username)
.to have_text(account.username)
end
def admin_user

View File

@ -43,7 +43,7 @@ RSpec.describe 'Admin::Roles' do
expect { click_on I18n.t('admin.roles.add_new') }
.to_not change(UserRole, :count)
expect(page)
.to have_content(I18n.t('activerecord.errors.models.user_role.attributes.position.elevated'))
.to have_text(I18n.t('activerecord.errors.models.user_role.attributes.position.elevated'))
# Valid submission
fill_in 'user_role_name', with: 'Baz'

View File

@ -13,12 +13,12 @@ RSpec.describe 'Admin Rules' do
visit admin_rules_path
expect(page)
.to have_content(I18n.t('admin.rules.title'))
.and have_content(rule.text)
.to have_text(I18n.t('admin.rules.title'))
.and have_text(rule.text)
click_on(rule.text)
expect(page)
.to have_content(I18n.t('admin.rules.title'))
.to have_text(I18n.t('admin.rules.title'))
end
end
@ -33,14 +33,14 @@ RSpec.describe 'Admin Rules' do
expect { submit_form }
.to_not change(Rule, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
# Valid submission
fill_in 'rule_text', with: 'No yelling on the bus!'
expect { submit_form }
.to change(Rule, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.rules.title'))
.to have_text(I18n.t('admin.rules.title'))
end
def submit_form
@ -56,16 +56,16 @@ RSpec.describe 'Admin Rules' do
visit admin_rules_path
expect(page)
.to have_content(I18n.t('admin.rules.title'))
.to have_text(I18n.t('admin.rules.title'))
expect(Rule.ordered.pluck(:text)).to eq ['This is another rule', 'This is a rule']
click_on(I18n.t('admin.rules.move_down'))
expect(page)
.to have_content(I18n.t('admin.rules.title'))
.and have_content(first_rule.text)
.and have_content(second_rule.text)
.to have_text(I18n.t('admin.rules.title'))
.and have_text(first_rule.text)
.and have_text(second_rule.text)
expect(Rule.ordered.pluck(:text)).to eq ['This is a rule', 'This is another rule']
end

View File

@ -18,7 +18,7 @@ RSpec.describe 'Admin::Settings::About' do
click_on submit_button
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def extended_description_field

View File

@ -18,7 +18,7 @@ RSpec.describe 'Admin::Settings::Appearance' do
click_on submit_button
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def custom_css_field

View File

@ -25,7 +25,7 @@ RSpec.describe 'Admin::Settings::Branding' do
.to change(Setting, :site_short_description).to('new key value')
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def short_description_field

View File

@ -18,7 +18,7 @@ RSpec.describe 'Admin::Settings::ContentRetention' do
click_on submit_button
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def media_cache_retention_period_field

View File

@ -17,7 +17,7 @@ RSpec.describe 'Admin::Settings::Discovery' do
click_on submit_button
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def trends_box

View File

@ -18,7 +18,7 @@ RSpec.describe 'Admin::Settings::Registrations' do
click_on submit_button
expect(page)
.to have_content(success_message)
.to have_text(success_message)
end
def open_mode_option

View File

@ -20,7 +20,7 @@ RSpec.describe 'Admin SiteUploads' do
expect { site_upload.reload }
.to raise_error(ActiveRecord::RecordNotFound)
expect(page)
.to have_content(I18n.t('admin.site_uploads.destroyed_msg'))
.to have_text(I18n.t('admin.site_uploads.destroyed_msg'))
.and have_title(I18n.t('admin.settings.branding.title'))
end
end

View File

@ -15,9 +15,9 @@ RSpec.describe 'finding software updates through the admin interface' do
expect(page)
.to have_title(I18n.t('admin.software_updates.title'))
.and have_content(latest_release.version)
.and have_content(other_release.version)
.and have_no_content(outdated_release.version)
.and have_text(latest_release.version)
.and have_text(other_release.version)
.and have_no_text(outdated_release.version)
within("#software_update_#{latest_release.id}") do
click_on I18n.t('admin.software_updates.release_notes')

View File

@ -19,7 +19,7 @@ RSpec.describe 'Admin::Statuses' do
it 'displays a notice about selection' do
click_on button_for_report
expect(page).to have_content(selection_error_text)
expect(page).to have_text(selection_error_text)
end
end

View File

@ -20,7 +20,7 @@ RSpec.describe 'Admin Tags' do
expect { click_on submit_button }
.to_not(change { tag.reload.display_name })
expect(page)
.to have_content(match_error_text)
.to have_text(match_error_text)
fill_in display_name_field, with: 'TEST'
expect { click_on submit_button }

View File

@ -14,8 +14,8 @@ RSpec.describe 'Admin Terms of Service Histories' do
visit admin_terms_of_service_history_path
expect(page)
.to have_content(I18n.t('admin.terms_of_service.history'))
.and have_content(/changelog notes from v1/)
.to have_text(I18n.t('admin.terms_of_service.history'))
.and have_text(/changelog notes from v1/)
end
end
end

View File

@ -15,7 +15,7 @@ RSpec.describe 'Admin Terms of services' do
.to have_title(I18n.t('admin.terms_of_service.title'))
expect(page)
.to have_content(terms.text)
.to have_text(terms.text)
end
end
end

View File

@ -17,7 +17,7 @@ RSpec.describe 'Admin::Trends::Links::PreviewCardProviders' do
click_on button_for_allow
expect(page)
.to have_content(selection_error_text)
.to have_text(selection_error_text)
end
end

View File

@ -17,7 +17,7 @@ RSpec.describe 'Admin::Trends::Links' do
click_on button_for_allow
expect(page)
.to have_content(selection_error_text)
.to have_text(selection_error_text)
end
end

View File

@ -17,7 +17,7 @@ RSpec.describe 'Admin::Trends::Statuses' do
click_on button_for_allow
expect(page)
.to have_content(selection_error_text)
.to have_text(selection_error_text)
end
end

View File

@ -16,7 +16,7 @@ RSpec.describe 'Admin::Trends::Tags' do
within('.filter-subset') do
expect(page)
.to have_content("#{I18n.t('admin.accounts.moderation.pending')} (0)")
.to have_text("#{I18n.t('admin.accounts.moderation.pending')} (0)")
end
end
end
@ -31,7 +31,7 @@ RSpec.describe 'Admin::Trends::Tags' do
click_on button_for_allow
expect(page).to have_content(selection_error_text)
expect(page).to have_text(selection_error_text)
end
end

View File

@ -13,8 +13,8 @@ RSpec.describe 'Admin Warning Presets' do
visit admin_warning_presets_path
expect(page)
.to have_content(I18n.t('admin.warning_presets.title'))
.and have_content(account_warning_preset.text)
.to have_text(I18n.t('admin.warning_presets.title'))
.and have_text(account_warning_preset.text)
end
end
@ -27,14 +27,14 @@ RSpec.describe 'Admin Warning Presets' do
expect { submit_form }
.to_not change(AccountWarningPreset, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
# Valid submission
fill_in 'account_warning_preset_text', with: 'You cant do that here'
expect { submit_form }
.to change(AccountWarningPreset, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.warning_presets.title'))
.to have_text(I18n.t('admin.warning_presets.title'))
end
def submit_form

View File

@ -13,12 +13,12 @@ RSpec.describe 'Admin Webhooks' do
visit admin_webhooks_path
expect(page)
.to have_content(I18n.t('admin.webhooks.title'))
.and have_content(webhook.url)
.to have_text(I18n.t('admin.webhooks.title'))
.and have_text(webhook.url)
click_on(webhook.url)
expect(page)
.to have_content(I18n.t('admin.webhooks.title'))
.to have_text(I18n.t('admin.webhooks.title'))
end
end
@ -29,14 +29,14 @@ RSpec.describe 'Admin Webhooks' do
# Visit new page
click_on I18n.t('admin.webhooks.add_new')
expect(page)
.to have_content(I18n.t('admin.webhooks.new'))
.to have_text(I18n.t('admin.webhooks.new'))
# Invalid submission (missing url, no events selected)
fill_in 'webhook_url', with: ''
expect { submit_form }
.to_not change(Webhook, :count)
expect(page)
.to have_content(/errors below/)
.to have_text(/errors below/)
# Valid submission
fill_in 'webhook_url', with: 'https://host.example/hooks/123'
@ -44,7 +44,7 @@ RSpec.describe 'Admin Webhooks' do
expect { submit_form }
.to change(Webhook, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.webhooks.title'))
.to have_text(I18n.t('admin.webhooks.title'))
end
it 'fails to create with no events selected' do
@ -54,7 +54,7 @@ RSpec.describe 'Admin Webhooks' do
expect { submit_form }
.to_not change(Webhook, :count)
expect(page)
.to have_content(/errors below/)
.to have_text(/errors below/)
end
def submit_form

View File

@ -10,7 +10,7 @@ RSpec.describe 'Auth Registration' do
visit new_user_registration_path
expect(page)
.to have_title(I18n.t('auth.register'))
.and have_content(rule.text)
.and have_text(rule.text)
end
end
@ -28,7 +28,7 @@ RSpec.describe 'Auth Registration' do
expect { fill_in_and_submit_form }
.to not_change(User, :count)
expect(page)
.to have_content(/error below/)
.to have_text(/error below/)
end
end
@ -45,7 +45,7 @@ RSpec.describe 'Auth Registration' do
expect(User.last)
.to have_attributes(email: 'test@example.com', age_verified_at: be_present)
expect(page)
.to have_content(I18n.t('auth.setup.title'))
.to have_text(I18n.t('auth.setup.title'))
end
end

View File

@ -12,7 +12,7 @@ RSpec.describe 'Auth Setup' do
visit auth_setup_path
expect(page)
.to have_content(I18n.t('auth.setup.title'))
.to have_text(I18n.t('auth.setup.title'))
find('summary.lead').click
fill_in 'user_email', with: 'new-email@example.host'
@ -20,7 +20,7 @@ RSpec.describe 'Auth Setup' do
expect { submit_form }
.to(change { user.reload.unconfirmed_email })
expect(page)
.to have_content(I18n.t('auth.setup.new_confirmation_instructions_sent'))
.to have_text(I18n.t('auth.setup.new_confirmation_instructions_sent'))
end
def submit_form

View File

@ -31,7 +31,7 @@ RSpec.describe 'email confirmation flow when captcha is enabled' do
# It presents a page with a link to the app callback
expect(page)
.to have_content(I18n.t('auth.confirmations.registration_complete', domain: local_domain_uri.host))
.to have_text(I18n.t('auth.confirmations.registration_complete', domain: local_domain_uri.host))
.and have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri)
end
end

View File

@ -23,7 +23,7 @@ RSpec.describe 'Dispute Appeals' do
expect(emails)
.to be_empty
expect(page)
.to have_content(/can't be blank/)
.to have_text(/can't be blank/)
# Valid with text
fill_in 'appeal_text', with: 'It wasnt me this time!'
@ -31,7 +31,7 @@ RSpec.describe 'Dispute Appeals' do
.to change(Appeal, :count).by(1)
.and send_email(to: admin.email, subject: new_appeal_subject)
expect(page)
.to have_content(I18n.t('disputes.strikes.appealed_msg'))
.to have_text(I18n.t('disputes.strikes.appealed_msg'))
end
def new_appeal_subject

View File

@ -17,7 +17,7 @@ RSpec.describe 'Disputes Strikes' do
find('.strike-entry').click
expect(page)
.to have_title(strike_page_title)
.and have_content(strike.text)
.and have_text(strike.text)
end
def strike_page_title

View File

@ -15,7 +15,7 @@ RSpec.describe 'Filters' do
visit filters_path
expect(page)
.to have_content('Photography')
.to have_text('Photography')
.and have_private_cache_control
end
end
@ -26,7 +26,7 @@ RSpec.describe 'Filters' do
click_on I18n.t('filters.new.title')
fill_in_filter_form
expect(page).to have_content(filter_title)
expect(page).to have_text(filter_title)
end
it 'Does not save with invalid values' do
@ -36,7 +36,7 @@ RSpec.describe 'Filters' do
expect { click_on I18n.t('filters.new.save') }
.to_not change(CustomFilter, :count)
expect(page)
.to have_content("can't be blank")
.to have_text("can't be blank")
end
end
@ -60,7 +60,7 @@ RSpec.describe 'Filters' do
.to change { keyword_one.reload.keyword }.to(/New value/)
.and(change { keyword_two.reload.keyword }.to(/Wilderness/))
expect(page).to have_content(new_title)
expect(page).to have_text(new_title)
end
it 'Does not save with invalid values' do
@ -72,7 +72,7 @@ RSpec.describe 'Filters' do
expect { click_on submit_button }
.to_not(change { custom_filter.reload.updated_at })
expect(page)
.to have_content("can't be blank")
.to have_text("can't be blank")
end
end
@ -82,12 +82,12 @@ RSpec.describe 'Filters' do
it 'Deletes the filter' do
navigate_to_filters
expect(page).to have_content filter_title
expect(page).to have_text filter_title
expect do
click_on I18n.t('filters.index.delete')
end.to change(CustomFilter, :count).by(-1)
expect(page).to have_no_content(filter_title)
expect(page).to have_no_text(filter_title)
end
end
@ -95,7 +95,7 @@ RSpec.describe 'Filters' do
visit settings_path
click_on I18n.t('filters.index.title')
expect(page).to have_content I18n.t('filters.index.title')
expect(page).to have_text I18n.t('filters.index.title')
end
def fill_in_filter_form

View File

@ -17,7 +17,7 @@ RSpec.describe 'Invites' do
within css_id(invite) do
expect(page)
.to have_content(invite.uses)
.to have_text(invite.uses)
.and have_private_cache_control
expect(copyable_field.value)
.to eq(public_invite_url(invite_code: invite.code))
@ -46,7 +46,7 @@ RSpec.describe 'Invites' do
.to change { invite.reload.expired? }.to(true)
within css_id(invite) do
expect(page).to have_content I18n.t('invites.expired')
expect(page).to have_text I18n.t('invites.expired')
end
end
end

View File

@ -24,7 +24,7 @@ RSpec.describe 'Using OAuth from an external app' do
subject
# It presents the user with an authorization page
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It grants the app access to the account
expect { click_on oauth_authorize_text }
@ -38,7 +38,7 @@ RSpec.describe 'Using OAuth from an external app' do
subject
# It presents the user with an authorization page
expect(page).to have_content(oauth_deny_text)
expect(page).to have_text(oauth_deny_text)
# It does not grant the app access to the account
expect { click_on oauth_deny_text }
@ -108,7 +108,7 @@ RSpec.describe 'Using OAuth from an external app' do
within '.form-container .flash-message' do
expect(page)
.to have_content(doorkeeper_invalid_code_message)
.to have_text(doorkeeper_invalid_code_message)
end
end
@ -133,7 +133,7 @@ RSpec.describe 'Using OAuth from an external app' do
subject
# It presents the user with the 2FA setup page
expect(page).to have_content(I18n.t('two_factor_authentication.role_requirement', domain: local_domain_uri.host))
expect(page).to have_text(I18n.t('two_factor_authentication.role_requirement', domain: local_domain_uri.host))
click_on I18n.t('otp_authentication.setup')
# Fill in challenge form
@ -150,7 +150,7 @@ RSpec.describe 'Using OAuth from an external app' do
click_on I18n.t('two_factor_authentication.resume_app_authorization')
# It presents the user with an authorization page
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It grants the app access to the account
expect { click_on oauth_authorize_text }
@ -177,15 +177,15 @@ RSpec.describe 'Using OAuth from an external app' do
visit "/oauth/authorize?#{params.to_query}"
# It presents the user with a log-in page
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Failing to log-in presents the form again
fill_in_auth_details(email, 'wrong password')
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Logging in redirects to an authorization page
fill_in_auth_details(email, password)
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It grants the app access to the account
expect { click_on oauth_authorize_text }
@ -199,15 +199,15 @@ RSpec.describe 'Using OAuth from an external app' do
visit "/oauth/authorize?#{params.to_query}"
# It presents the user with a log-in page
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Failing to log-in presents the form again
fill_in_auth_details(email, 'wrong password')
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Logging in redirects to an authorization page
fill_in_auth_details(email, password)
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It does not grant the app access to the account
expect { click_on oauth_deny_text }
@ -224,23 +224,23 @@ RSpec.describe 'Using OAuth from an external app' do
visit "/oauth/authorize?#{params.to_query}"
# It presents the user with a log-in page
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Failing to log-in presents the form again
fill_in_auth_details(email, 'wrong password')
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Logging in redirects to a two-factor authentication page
fill_in_auth_details(email, password)
expect(page).to have_content(I18n.t('simple_form.hints.sessions.otp'))
expect(page).to have_text(I18n.t('simple_form.hints.sessions.otp'))
# Filling in an incorrect two-factor authentication code presents the form again
fill_in_otp_details('wrong')
expect(page).to have_content(I18n.t('simple_form.hints.sessions.otp'))
expect(page).to have_text(I18n.t('simple_form.hints.sessions.otp'))
# Filling in the correct TOTP code redirects to an app authorization page
fill_in_otp_details(user.current_otp)
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It grants the app access to the account
expect { click_on oauth_authorize_text }
@ -254,23 +254,23 @@ RSpec.describe 'Using OAuth from an external app' do
visit "/oauth/authorize?#{params.to_query}"
# It presents the user with a log-in page
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Failing to log-in presents the form again
fill_in_auth_details(email, 'wrong password')
expect(page).to have_content(I18n.t('auth.login'))
expect(page).to have_text(I18n.t('auth.login'))
# Logging in redirects to a two-factor authentication page
fill_in_auth_details(email, password)
expect(page).to have_content(I18n.t('simple_form.hints.sessions.otp'))
expect(page).to have_text(I18n.t('simple_form.hints.sessions.otp'))
# Filling in an incorrect two-factor authentication code presents the form again
fill_in_otp_details('wrong')
expect(page).to have_content(I18n.t('simple_form.hints.sessions.otp'))
expect(page).to have_text(I18n.t('simple_form.hints.sessions.otp'))
# Filling in the correct TOTP code redirects to an app authorization page
fill_in_otp_details(user.current_otp)
expect(page).to have_content(oauth_authorize_text)
expect(page).to have_text(oauth_authorize_text)
# It does not grant the app access to the account
expect { click_on oauth_deny_text }

View File

@ -12,7 +12,7 @@ RSpec.describe 'redirection confirmations' do
visit "/@#{account.pretty_acct}"
expect(page)
.to have_content(redirect_title) # Redirect explanation
.to have_text(redirect_title) # Redirect explanation
.and have_link(account.url, href: account.url) # Appropriate account link
.and have_css('body', class: 'app-body')
end
@ -23,7 +23,7 @@ RSpec.describe 'redirection confirmations' do
visit "/@#{account.pretty_acct}/#{status.id}"
expect(page)
.to have_content(redirect_title) # Redirect explanation
.to have_text(redirect_title) # Redirect explanation
.and have_link(status.url, href: status.url) # Appropriate status link
.and have_css('body', class: 'app-body')
end

View File

@ -41,6 +41,6 @@ RSpec.describe 'report interface', :attachment_processing, :js, :streaming do
click_on I18n.t('admin.reports.mark_as_resolved')
end
expect(page)
.to have_content(I18n.t('admin.reports.resolved_msg'))
.to have_text(I18n.t('admin.reports.resolved_msg'))
end
end

View File

@ -14,7 +14,7 @@ RSpec.describe 'Settings aliases page' do
# View index page
expect(page)
.to have_content(I18n.t('settings.aliases'))
.to have_text(I18n.t('settings.aliases'))
.and have_private_cache_control
end
end
@ -31,7 +31,7 @@ RSpec.describe 'Settings aliases page' do
expect { submit_form }
.to change(AccountAlias, :count).by(1)
expect(page)
.to have_content(I18n.t('aliases.created_msg'))
.to have_text(I18n.t('aliases.created_msg'))
end
end
@ -44,7 +44,7 @@ RSpec.describe 'Settings aliases page' do
expect { submit_form }
.to not_change(AccountAlias, :count)
expect(page)
.to have_content(I18n.t('settings.aliases'))
.to have_text(I18n.t('settings.aliases'))
end
end
@ -66,8 +66,8 @@ RSpec.describe 'Settings aliases page' do
.to change(AccountAlias, :count).by(-1)
expect(page)
.to have_content(I18n.t('settings.aliases'))
.and have_content(I18n.t('aliases.deleted_msg'))
.to have_text(I18n.t('settings.aliases'))
.and have_text(I18n.t('aliases.deleted_msg'))
expect { account_alias.reload }
.to raise_error(ActiveRecord::RecordNotFound)
end

View File

@ -13,7 +13,7 @@ RSpec.describe 'Settings applications page' do
visit settings_applications_path
expect(page)
.to have_content(application.name)
.to have_text(application.name)
.and have_private_cache_control
end
end
@ -23,7 +23,7 @@ RSpec.describe 'Settings applications page' do
visit settings_application_path(application)
expect(page)
.to have_content(application.name)
.to have_text(application.name)
end
end
@ -36,11 +36,11 @@ RSpec.describe 'Settings applications page' do
expect { submit_form }
.to change(Doorkeeper::Application, :count).by(1)
expect(page)
.to have_content(I18n.t('doorkeeper.applications.index.title'))
.and have_content('My new app')
.and have_content('read')
.and have_content('write')
.and have_content('follow')
.to have_text(I18n.t('doorkeeper.applications.index.title'))
.and have_text('My new app')
.and have_text('read')
.and have_text('write')
.and have_text('follow')
end
it 'does not save with invalid form values' do
@ -49,7 +49,7 @@ RSpec.describe 'Settings applications page' do
expect { submit_form }
.to not_change(Doorkeeper::Application, :count)
expect(page)
.to have_content("can't be blank")
.to have_text("can't be blank")
end
def fill_in_form
@ -80,7 +80,7 @@ RSpec.describe 'Settings applications page' do
submit_form
expect(page)
.to have_content('My new app name with a new value')
.to have_text('My new app name with a new value')
.and have_checked_field('push', id: :doorkeeper_application_scopes_push)
end
@ -92,7 +92,7 @@ RSpec.describe 'Settings applications page' do
submit_form
expect(page)
.to have_content("can't be blank")
.to have_text("can't be blank")
end
def submit_form
@ -117,7 +117,7 @@ RSpec.describe 'Settings applications page' do
expect { destroy_application }
.to change(Doorkeeper::Application, :count).by(-1)
expect(page)
.to have_no_content(application.name)
.to have_no_text(application.name)
expect(redis_pipeline_stub)
.to have_received(:publish).with("timeline:access_token:#{access_token.id}", '{"event":"kill"}')
end
@ -141,7 +141,7 @@ RSpec.describe 'Settings applications page' do
expect { regenerate_token }
.to(change { user_application_token.first.token })
expect(page)
.to have_content(I18n.t('applications.token_regenerated'))
.to have_text(I18n.t('applications.token_regenerated'))
end
def user_application_token

View File

@ -18,13 +18,13 @@ RSpec.describe 'Settings Deletes' do
fill_in 'form_delete_confirmation_password', with: 'wrongvalue'
click_on I18n.t('deletes.proceed')
expect(page)
.to have_content(I18n.t('deletes.challenge_not_passed'))
.to have_text(I18n.t('deletes.challenge_not_passed'))
# Correct confirmation value
fill_in 'form_delete_confirmation_password', with: user.password
click_on I18n.t('deletes.proceed')
expect(page)
.to have_content(I18n.t('deletes.success_msg'))
.to have_text(I18n.t('deletes.success_msg'))
expect(page)
.to have_title(I18n.t('auth.login'))
expect(User.find_by(id: user.id))

View File

@ -13,7 +13,7 @@ RSpec.describe 'Export page' do
visit settings_export_path
expect(page)
.to have_content(takeout_summary)
.to have_text(takeout_summary)
.and have_private_cache_control
end
end
@ -26,7 +26,7 @@ RSpec.describe 'Export page' do
expect { request_archive }
.to change(BackupWorker.jobs, :size).by(1)
expect(page)
.to have_content(takeout_summary)
.to have_text(takeout_summary)
end
def request_archive

View File

@ -16,9 +16,9 @@ RSpec.describe 'Login activities page' do
click_on I18n.t('sessions.view_authentication_history')
expect(page)
.to have_content(browser_description)
.and have_content(login_activity.authentication_method)
.and have_content(login_activity.ip)
.to have_text(browser_description)
.and have_text(login_activity.authentication_method)
.and have_text(login_activity.ip)
.and have_private_cache_control
end

View File

@ -29,7 +29,7 @@ RSpec.describe 'Settings Migration Redirects' do
expect { click_on I18n.t('migrations.cancel') }
.to(change { user.reload.account.moved_to_account_id }.to(nil))
expect(page)
.to have_content(I18n.t('migrations.cancelled_msg'))
.to have_text(I18n.t('migrations.cancelled_msg'))
end
context 'when user has blank encrypted password' do

View File

@ -15,7 +15,7 @@ RSpec.describe 'Settings Migrations' do
visit settings_migration_path
expect(page)
.to have_content(I18n.t('settings.migrate'))
.to have_text(I18n.t('settings.migrate'))
end
end
@ -26,8 +26,8 @@ RSpec.describe 'Settings Migrations' do
visit settings_migration_path
expect(page)
.to have_content(I18n.t('settings.migrate'))
.and have_content(moved_to_account.pretty_acct)
.to have_text(I18n.t('settings.migrate'))
.and have_text(moved_to_account.pretty_acct)
end
end
end
@ -48,7 +48,7 @@ RSpec.describe 'Settings Migrations' do
expect { fill_in_and_submit }
.to(change { user.account.reload.moved_to_account_id }.to(acct.id))
expect(page)
.to have_content(I18n.t('settings.migrate'))
.to have_text(I18n.t('settings.migrate'))
end
end
@ -61,7 +61,7 @@ RSpec.describe 'Settings Migrations' do
expect { fill_in_and_submit_via_username("@#{user.account.username}") }
.to(change { user.account.reload.moved_to_account_id }.to(acct.id))
expect(page)
.to have_content(I18n.t('settings.migrate'))
.to have_text(I18n.t('settings.migrate'))
end
end
end
@ -75,7 +75,7 @@ RSpec.describe 'Settings Migrations' do
expect { fill_in_and_submit }
.to_not(change { user.account.reload.moved_to_account_id }.from(nil))
expect(page)
.to have_content(I18n.t('settings.migrate'))
.to have_text(I18n.t('settings.migrate'))
end
end
@ -88,7 +88,7 @@ RSpec.describe 'Settings Migrations' do
expect { fill_in_and_submit }
.to_not(change { user.account.reload.moved_to_account_id }.from(nil))
expect(page)
.to have_content(I18n.t('settings.migrate'))
.to have_text(I18n.t('settings.migrate'))
end
end

View File

@ -15,7 +15,7 @@ RSpec.describe 'Settings Privacy' do
# View settings page
visit settings_privacy_path
expect(page)
.to have_content(I18n.t('privacy.title'))
.to have_text(I18n.t('privacy.title'))
.and have_private_cache_control
# Fill out form and submit
@ -24,8 +24,8 @@ RSpec.describe 'Settings Privacy' do
expect { click_on submit_button }
.to change { user.account.reload.discoverable }.to(true)
expect(page)
.to have_content(I18n.t('privacy.title'))
.and have_content(success_message)
.to have_text(I18n.t('privacy.title'))
.and have_text(success_message)
expect(ActivityPub::UpdateDistributionWorker)
.to have_enqueued_sidekiq_job(user.account.id)
end
@ -40,7 +40,7 @@ RSpec.describe 'Settings Privacy' do
# View settings page
visit settings_privacy_path
expect(page)
.to have_content(I18n.t('privacy.title'))
.to have_text(I18n.t('privacy.title'))
.and have_private_cache_control
# Fill out form and submit
@ -49,7 +49,7 @@ RSpec.describe 'Settings Privacy' do
expect { click_on submit_button }
.to_not(change { user.account.reload.discoverable })
expect(page)
.to have_content(I18n.t('privacy.title'))
.to have_text(I18n.t('privacy.title'))
expect(ActivityPub::UpdateDistributionWorker)
.to_not have_enqueued_sidekiq_job(anything)
end

View File

@ -19,7 +19,7 @@ RSpec.describe 'Settings Sessions' do
expect { session_activation.reload }
.to raise_error(ActiveRecord::RecordNotFound)
expect(page)
.to have_content(I18n.t('sessions.revoke_success'))
.to have_text(I18n.t('sessions.revoke_success'))
end
end
end

View File

@ -24,10 +24,10 @@ RSpec.describe 'Settings TwoFactorAuthentication RecoveryCodes' do
.to(change { user.reload.otp_backup_codes })
expect(page)
.to have_content(I18n.t('two_factor_authentication.recovery_codes_regenerated'))
.to have_text(I18n.t('two_factor_authentication.recovery_codes_regenerated'))
.and have_title(I18n.t('settings.two_factor_authentication'))
.and have_css('ol.recovery-codes')
.and have_content(backup_code)
.and have_text(backup_code)
end
def stub_code_generator

View File

@ -14,7 +14,7 @@ RSpec.describe 'Settings TwoFactorAuthenticationMethods' do
it 'disables 2FA with challenge confirmation', :inline_jobs do
visit settings_two_factor_authentication_methods_path
expect(page)
.to have_content(I18n.t('settings.two_factor_authentication'))
.to have_text(I18n.t('settings.two_factor_authentication'))
.and have_private_cache_control
# Attempt to disable
@ -29,7 +29,7 @@ RSpec.describe 'Settings TwoFactorAuthenticationMethods' do
.and send_email(to: user.email, subject: I18n.t('devise.mailer.two_factor_disabled.subject'))
expect(page)
.to have_content(I18n.t('two_factor_authentication.disabled_success'))
.to have_text(I18n.t('two_factor_authentication.disabled_success'))
end
end
end

View File

@ -12,7 +12,7 @@ RSpec.describe 'Settings verification page' do
visit settings_verification_path
expect(page)
.to have_content(verification_summary)
.to have_text(verification_summary)
.and have_private_cache_control
fill_in attribution_field, with: " example.com\n\n https://example.net"
@ -20,9 +20,9 @@ RSpec.describe 'Settings verification page' do
expect { click_on submit_button }
.to(change { user.account.reload.attribution_domains }.to(['example.com', 'example.net']))
expect(page)
.to have_content(success_message)
.to have_text(success_message)
expect(find_field(attribution_field).value)
.to have_content("example.com\nexample.net")
.to have_text("example.com\nexample.net")
end
it 'rejects invalid attribution domains' do
@ -33,9 +33,9 @@ RSpec.describe 'Settings verification page' do
expect { click_on submit_button }
.to_not(change { user.account.reload.attribution_domains })
expect(page)
.to have_content(I18n.t('activerecord.errors.messages.invalid_domain_on_line', value: 'invalid_com'))
.to have_text(I18n.t('activerecord.errors.messages.invalid_domain_on_line', value: 'invalid_com'))
expect(find_field(attribution_field).value)
.to have_content("example.com\ninvalid_com")
.to have_text("example.com\ninvalid_com")
end
end

View File

@ -23,7 +23,7 @@ RSpec.describe 'Automated post deletion settings' do
expect { submit_form }
.to change { account.reload.statuses_cleanup_policy.keep_pinned? }.to(false)
expect(page)
.to have_content(I18n.t('settings.statuses_cleanup'))
.to have_text(I18n.t('settings.statuses_cleanup'))
end
def submit_form