gitlab-org--gitlab-foss/spec/views/admin/dashboard/index.html.haml_spec.rb
Stan Hu b6125f7045 Fix fast admin counters not working when PostgreSQL has secondaries
This commit does a number of things:

1. Reduces the number of queries needed by perform a single query to get all
the tuples for the relevant rows.

2. Uses a transaction to query the tuple counts to ensure that the data
is retrieved from the primary.

Closes #46742
2018-05-25 22:58:43 -07:00

32 lines
915 B
Ruby

require 'spec_helper'
describe 'admin/dashboard/index.html.haml' do
include Devise::Test::ControllerHelpers
before do
counts = Admin::DashboardController::COUNTED_ITEMS.each_with_object({}) do |item, hash|
hash[item] = 100
end
assign(:counts, counts)
assign(:projects, create_list(:project, 1))
assign(:users, create_list(:user, 1))
assign(:groups, create_list(:group, 1))
allow(view).to receive(:admin?).and_return(true)
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
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
it "includes revision of GitLab" do
render
expect(rendered).to have_content "#{Gitlab::VERSION} (#{Gitlab.revision})"
end
end