2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
describe 'admin visits dashboard', :js do
|
2018-12-13 13:39:08 +05:30
|
|
|
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
|
2019-10-12 21:52:04 +05:30
|
|
|
ActiveRecord::Base.connection.execute('ANALYZE fork_networks')
|
|
|
|
ActiveRecord::Base.connection.execute('ANALYZE fork_network_members')
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
visit admin_root_path
|
|
|
|
|
|
|
|
expect(page).to have_content('Forks 2')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|