Merge remote-tracking branch 'parent/main' into upstream-20240117
This commit is contained in:
commit
5d79bd078c
150 changed files with 2982 additions and 1485 deletions
|
@ -5,9 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::EmailDomainBlocks' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
|
@ -22,6 +20,27 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:email_domain_block) { Fabricate :email_domain_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_email_domain_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(EmailDomainBlock, :count).by(-1)
|
||||
expect { email_domain_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.email_domain_blocks.delete')
|
||||
end
|
||||
|
|
18
spec/system/admin/follow_recommendations_spec.rb
Normal file
18
spec/system/admin/follow_recommendations_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin Follow Recommendations' do
|
||||
let(:user) { Fabricate(:admin_user) }
|
||||
|
||||
before { sign_in(user) }
|
||||
|
||||
describe 'Viewing follow recommendations details' do
|
||||
it 'shows a list of accounts' do
|
||||
visit admin_follow_recommendations_path
|
||||
|
||||
expect(page)
|
||||
.to have_content(I18n.t('admin.follow_recommendations.title'))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -48,6 +48,27 @@ RSpec.describe 'Admin::IpBlocks' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:ip_block) { Fabricate :ip_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_ip_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(IpBlock, :count).by(-1)
|
||||
expect { ip_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.ip_blocks.delete')
|
||||
end
|
||||
|
|
21
spec/system/admin/terms_of_service/histories_spec.rb
Normal file
21
spec/system/admin/terms_of_service/histories_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin Terms of Service Histories' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before { sign_in(current_user) }
|
||||
|
||||
describe 'Viewing TOS histories' do
|
||||
before { Fabricate :terms_of_service, changelog: 'The changelog notes from v1 are here' }
|
||||
|
||||
it 'shows previous terms versions' 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/)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -5,20 +5,49 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::Trends::Links::PreviewCardProviders' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
visit admin_trends_links_preview_card_providers_path
|
||||
end
|
||||
|
||||
context 'without selecting any records' do
|
||||
it 'displays a notice about selection' do
|
||||
visit admin_trends_links_preview_card_providers_path
|
||||
|
||||
click_on button_for_allow
|
||||
|
||||
expect(page).to have_content(selection_error_text)
|
||||
expect(page)
|
||||
.to have_content(selection_error_text)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with providers that are not trendable' do
|
||||
let!(:provider) { Fabricate :preview_card_provider, trendable: false }
|
||||
|
||||
it 'allows the providers' do
|
||||
visit admin_trends_links_preview_card_providers_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow }
|
||||
.to change { provider.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with providers that are trendable' do
|
||||
let!(:provider) { Fabricate :preview_card_provider, trendable: true }
|
||||
|
||||
it 'disallows the providers' do
|
||||
visit admin_trends_links_preview_card_providers_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow }
|
||||
.to change { provider.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,6 +55,10 @@ RSpec.describe 'Admin::Trends::Links::PreviewCardProviders' do
|
|||
I18n.t('admin.trends.allow')
|
||||
end
|
||||
|
||||
def button_for_disallow
|
||||
I18n.t('admin.trends.disallow')
|
||||
end
|
||||
|
||||
def selection_error_text
|
||||
I18n.t('admin.trends.links.publishers.no_publisher_selected')
|
||||
end
|
||||
|
|
|
@ -5,20 +5,77 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::Trends::Links' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
visit admin_trends_links_path
|
||||
end
|
||||
|
||||
context 'without selecting any records' do
|
||||
it 'displays a notice about selection' do
|
||||
visit admin_trends_links_path
|
||||
|
||||
click_on button_for_allow
|
||||
|
||||
expect(page).to have_content(selection_error_text)
|
||||
expect(page)
|
||||
.to have_content(selection_error_text)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with links that are not trendable' do
|
||||
let!(:preview_card_trend) { Fabricate :preview_card_trend, preview_card: Fabricate(:preview_card, trendable: false) }
|
||||
|
||||
it 'allows the links' do
|
||||
visit admin_trends_links_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow }
|
||||
.to change { preview_card_trend.preview_card.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with links whose providers are not trendable' do
|
||||
let(:preview_card_provider) { Fabricate :preview_card_provider, trendable: false }
|
||||
let!(:preview_card_trend) { Fabricate :preview_card_trend, preview_card: Fabricate(:preview_card, url: "https://#{preview_card_provider.domain}/page") }
|
||||
|
||||
it 'allows the providers of the links' do
|
||||
visit admin_trends_links_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow_providers }
|
||||
.to change { preview_card_trend.preview_card.provider.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with links that are trendable' do
|
||||
let!(:preview_card_trend) { Fabricate :preview_card_trend, preview_card: Fabricate(:preview_card, trendable: true) }
|
||||
|
||||
it 'disallows the links' do
|
||||
visit admin_trends_links_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow }
|
||||
.to change { preview_card_trend.preview_card.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with links whose providers are trendable' do
|
||||
let(:preview_card_provider) { Fabricate :preview_card_provider, trendable: true }
|
||||
let!(:preview_card_trend) { Fabricate :preview_card_trend, preview_card: Fabricate(:preview_card, url: "https://#{preview_card_provider.domain}/page") }
|
||||
|
||||
it 'disallows the links' do
|
||||
visit admin_trends_links_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow_providers }
|
||||
.to change { preview_card_trend.preview_card.provider.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,6 +83,18 @@ RSpec.describe 'Admin::Trends::Links' do
|
|||
I18n.t('admin.trends.links.allow')
|
||||
end
|
||||
|
||||
def button_for_allow_providers
|
||||
I18n.t('admin.trends.links.allow_provider')
|
||||
end
|
||||
|
||||
def button_for_disallow
|
||||
I18n.t('admin.trends.links.disallow')
|
||||
end
|
||||
|
||||
def button_for_disallow_providers
|
||||
I18n.t('admin.trends.links.disallow_provider')
|
||||
end
|
||||
|
||||
def selection_error_text
|
||||
I18n.t('admin.trends.links.no_link_selected')
|
||||
end
|
||||
|
|
|
@ -5,20 +5,75 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::Trends::Statuses' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
visit admin_trends_statuses_path
|
||||
end
|
||||
|
||||
context 'without selecting any records' do
|
||||
it 'displays a notice about selection' do
|
||||
visit admin_trends_statuses_path
|
||||
|
||||
click_on button_for_allow
|
||||
|
||||
expect(page).to have_content(selection_error_text)
|
||||
expect(page)
|
||||
.to have_content(selection_error_text)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with statuses that are not trendable' do
|
||||
let!(:status_trend) { Fabricate :status_trend, status: Fabricate(:status, trendable: false) }
|
||||
|
||||
it 'allows the statuses' do
|
||||
visit admin_trends_statuses_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow }
|
||||
.to change { status_trend.status.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with statuses whose accounts are not trendable' do
|
||||
let!(:status_trend) { Fabricate :status_trend, status: Fabricate(:status, account: Fabricate(:account, trendable: false)) }
|
||||
|
||||
it 'allows the accounts of the statuses' do
|
||||
visit admin_trends_statuses_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow_accounts }
|
||||
.to change { status_trend.status.account.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with statuses that are trendable' do
|
||||
let!(:status_trend) { Fabricate :status_trend, status: Fabricate(:status, trendable: true) }
|
||||
|
||||
it 'disallows the statuses' do
|
||||
visit admin_trends_statuses_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow }
|
||||
.to change { status_trend.status.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with statuses whose accounts are trendable' do
|
||||
let!(:status_trend) { Fabricate :status_trend, status: Fabricate(:status, account: Fabricate(:account, trendable: true)) }
|
||||
|
||||
it 'disallows the statuses' do
|
||||
visit admin_trends_statuses_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow_accounts }
|
||||
.to change { status_trend.status.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,6 +81,18 @@ RSpec.describe 'Admin::Trends::Statuses' do
|
|||
I18n.t('admin.trends.statuses.allow')
|
||||
end
|
||||
|
||||
def button_for_allow_accounts
|
||||
I18n.t('admin.trends.statuses.allow_account')
|
||||
end
|
||||
|
||||
def button_for_disallow
|
||||
I18n.t('admin.trends.statuses.disallow')
|
||||
end
|
||||
|
||||
def button_for_disallow_accounts
|
||||
I18n.t('admin.trends.statuses.disallow_account')
|
||||
end
|
||||
|
||||
def selection_error_text
|
||||
I18n.t('admin.trends.statuses.no_status_selected')
|
||||
end
|
||||
|
|
|
@ -5,27 +5,59 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::Trends::Tags' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
visit admin_trends_tags_path
|
||||
end
|
||||
|
||||
context 'without selecting any records' do
|
||||
it 'displays a notice about selection' do
|
||||
visit admin_trends_tags_path
|
||||
|
||||
click_on button_for_allow
|
||||
|
||||
expect(page).to have_content(selection_error_text)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with tags that are not trendable' do
|
||||
let!(:tag_trend) { Fabricate :tag_trend, tag: Fabricate(:tag, trendable: false) }
|
||||
|
||||
it 'allows the tags' do
|
||||
visit admin_trends_tags_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_allow }
|
||||
.to change { tag_trend.tag.reload.trendable? }.from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with tags that are trendable' do
|
||||
let!(:tag_trend) { Fabricate :tag_trend, tag: Fabricate(:tag, trendable: true) }
|
||||
|
||||
it 'disallows the tags' do
|
||||
visit admin_trends_tags_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_disallow }
|
||||
.to change { tag_trend.tag.reload.trendable? }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_allow
|
||||
I18n.t('admin.trends.allow')
|
||||
end
|
||||
|
||||
def button_for_disallow
|
||||
I18n.t('admin.trends.disallow')
|
||||
end
|
||||
|
||||
def selection_error_text
|
||||
I18n.t('admin.trends.tags.no_tag_selected')
|
||||
end
|
||||
|
|
30
spec/system/auth/setup_spec.rb
Normal file
30
spec/system/auth/setup_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Auth Setup' do
|
||||
context 'with an unconfirmed signed in user' do
|
||||
let(:user) { Fabricate(:user, confirmed_at: nil) }
|
||||
|
||||
before { sign_in(user) }
|
||||
|
||||
it 'can update email address' do
|
||||
visit auth_setup_path
|
||||
|
||||
expect(page)
|
||||
.to have_content(I18n.t('auth.setup.title'))
|
||||
|
||||
find('summary.lead').click
|
||||
fill_in 'user_email', with: 'new-email@example.host'
|
||||
|
||||
expect { submit_form }
|
||||
.to(change { user.reload.unconfirmed_email })
|
||||
expect(page)
|
||||
.to have_content(I18n.t('auth.setup.new_confirmation_instructions_sent'))
|
||||
end
|
||||
|
||||
def submit_form
|
||||
find('[name=button]').click
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue