debian-mirror-gitlab/spec/support/shared_examples/lib/sidebars/projects/menus/zentao_menu_shared_examples.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.3 KiB
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.shared_examples 'ZenTao menu with CE version' do
let(:project) { create(:project, has_external_issue_tracker: true) }
2022-04-04 11:22:00 +05:30
let(:user) { project.first_owner }
2021-12-11 22:18:48 +05:30
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
let(:zentao_integration) { create(:zentao_integration, project: project) }
subject { described_class.new(context) }
describe '#render?' do
context 'when issues integration is disabled' do
before do
zentao_integration.update!(active: false)
end
it 'returns false' do
expect(subject.render?).to eq false
end
end
context 'when issues integration is enabled' do
before do
zentao_integration.update!(active: true)
end
it 'returns true' do
expect(subject.render?).to eq true
end
it 'renders menu link' do
expect(subject.link).to eq zentao_integration.url
end
2022-06-21 17:19:12 +05:30
it 'renders external-link icon' do
expect(subject.sprite_icon).to eq 'external-link'
end
it 'renders ZenTao menu' do
expect(subject.title).to eq s_('ZentaoIntegration|ZenTao')
end
it 'does not contain items' do
expect(subject.renderable_items.count).to eq 0
2021-12-11 22:18:48 +05:30
end
end
end
end