gitlab-org--gitlab-foss/spec/features/admin/dashboard_spec.rb
Bob Van Landuyt f3fba178b9 Remove the ForkedProjectLink model
This removes the `ForkedProjectLink` model that has been replaced by
the `ForkNetworkMember` and `ForkNetwork` combination. All existing
relations have been adjusted to use these new models.

The `forked_project_link` table has been dropped.

The "Forks" count on the admin dashboard has been updated to count all
`ForkNetworkMember` rows and deduct the number of `ForkNetwork`
rows. This is because now the "root-project" of a fork network also
has a `ForkNetworkMember` row. This count could become inaccurate when
the root of a fork network is deleted.
2018-10-19 11:57:20 +02:00

28 lines
743 B
Ruby

require 'spec_helper'
describe 'admin visits dashboard' do
include ProjectForksHelper
before do
sign_in(create(:admin))
end
context 'counting forks' do
it 'correctly counts 2 forks of a project' do
project = create(:project)
project_fork = fork_project(project)
fork_project(project_fork)
# Make sure the fork_networks & fork_networks reltuples have been updated
# to get a correct count on postgresql
if Gitlab::Database.postgresql?
ActiveRecord::Base.connection.execute('ANALYZE fork_networks')
ActiveRecord::Base.connection.execute('ANALYZE fork_network_members')
end
visit admin_root_path
expect(page).to have_content('Forks 2')
end
end
end