Remove remaining `without_partial_double_verification` usage (#28127)
This commit is contained in:
parent
1d7b8234c9
commit
0b4a3a0437
|
@ -29,15 +29,25 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
describe 'body_classes' do
|
describe 'body_classes' do
|
||||||
context 'with a body class string from a controller' do
|
context 'with a body class string from a controller' do
|
||||||
before do
|
before { helper.extend controller_helpers }
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive_messages(body_class_string: 'modal-layout compose-standalone', current_theme: 'default', current_account: Fabricate(:account))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'uses the controller body classes in the result' do
|
it 'uses the controller body classes in the result' do
|
||||||
expect(helper.body_classes).to match(/modal-layout compose-standalone/)
|
expect(helper.body_classes).to match(/modal-layout compose-standalone/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def controller_helpers
|
||||||
|
Module.new do
|
||||||
|
def body_class_string = 'modal-layout compose-standalone'
|
||||||
|
|
||||||
|
def current_account
|
||||||
|
@current_account ||= Fabricate(:account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_theme = 'default'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,9 +132,7 @@ describe ApplicationHelper do
|
||||||
describe 'available_sign_up_path' do
|
describe 'available_sign_up_path' do
|
||||||
context 'when registrations are closed' do
|
context 'when registrations are closed' do
|
||||||
before do
|
before do
|
||||||
without_partial_double_verification do
|
allow(Setting).to receive(:[]).with('registrations_mode').and_return 'none'
|
||||||
allow(Setting).to receive(:registrations_mode).and_return('none')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to joinmastodon site' do
|
it 'redirects to joinmastodon site' do
|
||||||
|
|
|
@ -23,13 +23,20 @@ RSpec.describe HomeHelper do
|
||||||
context 'with a valid account' do
|
context 'with a valid account' do
|
||||||
let(:account) { Fabricate(:account) }
|
let(:account) { Fabricate(:account) }
|
||||||
|
|
||||||
|
before { helper.extend controller_helpers }
|
||||||
|
|
||||||
it 'returns a link to the account' do
|
it 'returns a link to the account' do
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive_messages(current_account: account, prefers_autoplay?: false)
|
|
||||||
result = helper.account_link_to(account)
|
result = helper.account_link_to(account)
|
||||||
|
|
||||||
expect(result).to match "@#{account.acct}"
|
expect(result).to match "@#{account.acct}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def controller_helpers
|
||||||
|
Module.new do
|
||||||
|
def current_account = Account.last
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,16 +3,12 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe MediaComponentHelper do
|
describe MediaComponentHelper do
|
||||||
|
before { helper.extend controller_helpers }
|
||||||
|
|
||||||
describe 'render_video_component' do
|
describe 'render_video_component' do
|
||||||
let(:media) { Fabricate(:media_attachment, type: :video, status: Fabricate(:status)) }
|
let(:media) { Fabricate(:media_attachment, type: :video, status: Fabricate(:status)) }
|
||||||
let(:result) { helper.render_video_component(media.status) }
|
let(:result) { helper.render_video_component(media.status) }
|
||||||
|
|
||||||
before do
|
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive(:current_account).and_return(media.account)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'renders a react component for the video' do
|
it 'renders a react component for the video' do
|
||||||
expect(parsed_html.div['data-component']).to eq('Video')
|
expect(parsed_html.div['data-component']).to eq('Video')
|
||||||
end
|
end
|
||||||
|
@ -22,12 +18,6 @@ describe MediaComponentHelper do
|
||||||
let(:media) { Fabricate(:media_attachment, type: :audio, status: Fabricate(:status)) }
|
let(:media) { Fabricate(:media_attachment, type: :audio, status: Fabricate(:status)) }
|
||||||
let(:result) { helper.render_audio_component(media.status) }
|
let(:result) { helper.render_audio_component(media.status) }
|
||||||
|
|
||||||
before do
|
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive(:current_account).and_return(media.account)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'renders a react component for the audio' do
|
it 'renders a react component for the audio' do
|
||||||
expect(parsed_html.div['data-component']).to eq('Audio')
|
expect(parsed_html.div['data-component']).to eq('Audio')
|
||||||
end
|
end
|
||||||
|
@ -37,12 +27,6 @@ describe MediaComponentHelper do
|
||||||
let(:media) { Fabricate(:media_attachment, type: :audio, status: Fabricate(:status)) }
|
let(:media) { Fabricate(:media_attachment, type: :audio, status: Fabricate(:status)) }
|
||||||
let(:result) { helper.render_media_gallery_component(media.status) }
|
let(:result) { helper.render_media_gallery_component(media.status) }
|
||||||
|
|
||||||
before do
|
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive(:current_account).and_return(media.account)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'renders a react component for the media gallery' do
|
it 'renders a react component for the media gallery' do
|
||||||
expect(parsed_html.div['data-component']).to eq('MediaGallery')
|
expect(parsed_html.div['data-component']).to eq('MediaGallery')
|
||||||
end
|
end
|
||||||
|
@ -54,10 +38,6 @@ describe MediaComponentHelper do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
PreviewCardsStatus.create(status: status, preview_card: Fabricate(:preview_card))
|
PreviewCardsStatus.create(status: status, preview_card: Fabricate(:preview_card))
|
||||||
|
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive(:current_account).and_return(status.account)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the correct react component markup' do
|
it 'returns the correct react component markup' do
|
||||||
|
@ -69,12 +49,6 @@ describe MediaComponentHelper do
|
||||||
let(:status) { Fabricate(:status, poll: Fabricate(:poll)) }
|
let(:status) { Fabricate(:status, poll: Fabricate(:poll)) }
|
||||||
let(:result) { helper.render_poll_component(status) }
|
let(:result) { helper.render_poll_component(status) }
|
||||||
|
|
||||||
before do
|
|
||||||
without_partial_double_verification do
|
|
||||||
allow(helper).to receive(:current_account).and_return(status.account)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns the correct react component markup' do
|
it 'returns the correct react component markup' do
|
||||||
expect(parsed_html.div['data-component']).to eq('Poll')
|
expect(parsed_html.div['data-component']).to eq('Poll')
|
||||||
end
|
end
|
||||||
|
@ -85,4 +59,10 @@ describe MediaComponentHelper do
|
||||||
def parsed_html
|
def parsed_html
|
||||||
Nokogiri::Slop(result)
|
Nokogiri::Slop(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def controller_helpers
|
||||||
|
Module.new do
|
||||||
|
def current_account = Account.last
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue