Commit aa7dd0e5 authored by Justin Ho's avatar Justin Ho

Add new error states to view specs

parent af8055ec
......@@ -30,4 +30,29 @@ RSpec.describe 'projects/hooks/edit' do
expect(rendered).to have_text(s_('Webhooks|Webhook was automatically disabled'))
end
end
context 'webhook is permanently disabled' do
before do
allow(hook).to receive(:permanently_disabled?).and_return(true)
end
it 'renders alert' do
render
expect(rendered).to have_text(s_('Webhooks|Webhook failed to connect'))
end
end
context 'webhook is temporarily disabled' do
before do
allow(hook).to receive(:temporarily_disabled?).and_return(true)
allow(hook).to receive(:disabled_until).and_return(Time.now + 10.minutes)
end
it 'renders alert' do
render
expect(rendered).to have_text(s_('Webhooks|Webhook fails to connect'))
end
end
end
......@@ -20,6 +20,8 @@ RSpec.describe 'projects/hooks/index' do
expect(rendered).to have_css('h4', text: _('Webhooks'))
expect(rendered).to have_text('Project Hooks')
expect(rendered).not_to have_css('.gl-badge', text: _('Disabled'))
expect(rendered).not_to have_css('.gl-badge', text: s_('Webhooks|Failed to connect'))
expect(rendered).not_to have_css('.gl-badge', text: s_('Webhooks|Fails to connect'))
end
context 'webhook is rate limited' do
......@@ -33,4 +35,28 @@ RSpec.describe 'projects/hooks/index' do
expect(rendered).to have_css('.gl-badge', text: _('Disabled'))
end
end
context 'webhook is permanently disabled' do
before do
allow(existing_hook).to receive(:permanently_disabled?).and_return(true)
end
it 'renders "Failed to connect" badge' do
render
expect(rendered).to have_css('.gl-badge', text: s_('Webhooks|Failed to connect'))
end
end
context 'webhook is temporarily disabled' do
before do
allow(existing_hook).to receive(:temporarily_disabled?).and_return(true)
end
it 'renders "Fails to connect" badge' do
render
expect(rendered).to have_css('.gl-badge', text: s_('Webhooks|Fails to connect'))
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment