2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'admin/dashboard/index.html.haml' do
|
2016-11-03 12:29:30 +05:30
|
|
|
include Devise::Test::ControllerHelpers
|
2021-04-29 21:17:54 +05:30
|
|
|
include StubVersion
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-08 19:23:39 +05:30
|
|
|
counts = Admin::DashboardController::COUNTED_ITEMS.each_with_object({}) do |item, hash|
|
|
|
|
hash[item] = 100
|
|
|
|
end
|
|
|
|
|
|
|
|
assign(:counts, counts)
|
2017-09-10 17:25:29 +05:30
|
|
|
assign(:projects, create_list(:project, 1))
|
2016-09-13 17:45:13 +05:30
|
|
|
assign(:users, create_list(:user, 1))
|
|
|
|
assign(:groups, create_list(:group, 1))
|
|
|
|
|
|
|
|
allow(view).to receive(:admin?).and_return(true)
|
2018-03-17 18:26:18 +05:30
|
|
|
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "shows version of GitLab Workhorse" do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content 'GitLab Workhorse'
|
|
|
|
expect(rendered).to have_content Gitlab::Workhorse.version
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
it "includes revision of GitLab for pre VERSION" do
|
|
|
|
stub_version('13.11.0-pre', 'abcdefg')
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content "13.11.0-pre abcdefg"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the tag for GitLab version' do
|
|
|
|
stub_version('13.11.0', 'abcdefg')
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
render
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(rendered).to have_content "13.11.0"
|
|
|
|
expect(rendered).not_to have_content "abcdefg"
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
it 'does not include license breakdown' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_content "Users in License"
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(rendered).not_to have_content "Billable Users"
|
2020-10-24 23:57:45 +05:30
|
|
|
expect(rendered).not_to have_content "Maximum Users"
|
|
|
|
expect(rendered).not_to have_content "Users over License"
|
|
|
|
end
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
describe 'when show_version_check? is true' do
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:show_version_check?).and_return(true)
|
|
|
|
render
|
|
|
|
end
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
it 'renders the version check badge' do
|
|
|
|
expect(rendered).to have_selector('.js-gitlab-version-check')
|
|
|
|
end
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
2022-04-04 11:22:00 +05:30
|
|
|
|
|
|
|
describe 'GitLab KAS' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Kas).to receive(:enabled?).and_return(enabled)
|
|
|
|
allow(Gitlab::Kas).to receive(:version).and_return('kas-1.2.3')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'KAS enabled' do
|
|
|
|
let(:enabled) { true }
|
|
|
|
|
|
|
|
it 'includes KAS version' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content('GitLab KAS')
|
|
|
|
expect(rendered).to have_content('kas-1.2.3')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'KAS disabled' do
|
|
|
|
let(:enabled) { false }
|
|
|
|
|
|
|
|
it 'does not include KAS version' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_content('GitLab KAS')
|
|
|
|
expect(rendered).not_to have_content('kas-1.2.3')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|