summaryrefslogtreecommitdiff
path: root/spec/features/admin
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-08-31 19:16:34 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-10-19 11:57:20 +0200
commitf3fba178b931cd2ba67f81ee667893cb84e7d42f (patch)
tree24c5a688880d5edd75642a7f16623124bde9fc22 /spec/features/admin
parent4321d70d24a6a7dc99f80fa4211ba6250504d99b (diff)
downloadgitlab-ce-f3fba178b931cd2ba67f81ee667893cb84e7d42f.tar.gz
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.
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/dashboard_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb
new file mode 100644
index 00000000000..a6ca0803469
--- /dev/null
+++ b/spec/features/admin/dashboard_spec.rb
@@ -0,0 +1,28 @@
+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