mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-16 03:43:08 +00:00
Fix broken view spec for about/links (#2591)
This commit is contained in:
parent
298d28af51
commit
a823509b99
|
@ -3,33 +3,36 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe 'about/_links.html.haml' do
|
describe 'about/_links.html.haml' do
|
||||||
it 'does not show sign in link when signed in' do
|
context 'when signed in' do
|
||||||
instance_presenter = double(:instance_presenter, open_registrations: true)
|
before do
|
||||||
assign(:instance_presenter, instance_presenter)
|
|
||||||
allow(view).to receive(:user_signed_in?).and_return(true)
|
allow(view).to receive(:user_signed_in?).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not show sign in link' do
|
||||||
render 'about/links', instance: InstancePresenter.new
|
render 'about/links', instance: InstancePresenter.new
|
||||||
|
|
||||||
expect(rendered).to have_content(I18n.t('about.get_started'))
|
expect(rendered).to have_content(I18n.t('about.get_started'))
|
||||||
expect(rendered).not_to have_content(I18n.t('auth.login'))
|
expect(rendered).not_to have_content(I18n.t('auth.login'))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'shows sign in link when signed out' do
|
context 'when signed out' do
|
||||||
instance_presenter = double(:instance_presenter, open_registrations: true)
|
before do
|
||||||
assign(:instance_presenter, instance_presenter)
|
|
||||||
allow(view).to receive(:user_signed_in?).and_return(false)
|
allow(view).to receive(:user_signed_in?).and_return(false)
|
||||||
render 'about/links', instance: InstancePresenter.new
|
end
|
||||||
|
|
||||||
|
it 'shows get started link when registrations are allowed' do
|
||||||
|
render 'about/links', instance: double(open_registrations: true)
|
||||||
|
|
||||||
expect(rendered).to have_content(I18n.t('about.get_started'))
|
expect(rendered).to have_content(I18n.t('about.get_started'))
|
||||||
expect(rendered).to have_content(I18n.t('auth.login'))
|
expect(rendered).to have_content(I18n.t('auth.login'))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'shows sign in link when register closed' do
|
it 'hides get started link when registrations are closed' do
|
||||||
instance_presenter = double(:instance_presenter, open_registrations: false)
|
render 'about/links', instance: double(open_registrations: false)
|
||||||
assign(:instance_presenter, instance_presenter)
|
|
||||||
allow(view).to receive(:user_signed_in?).and_return(false)
|
|
||||||
render
|
|
||||||
|
|
||||||
expect(rendered).not_to have_content(I18n.t('about.get_started'))
|
expect(rendered).not_to have_content(I18n.t('about.get_started'))
|
||||||
expect(rendered).to have_content(I18n.t('auth.login'))
|
expect(rendered).to have_content(I18n.t('auth.login'))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue