diff options
author | Rémy Coutable <remy@rymai.me> | 2019-05-16 12:30:42 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-05-16 14:59:21 +0200 |
commit | ec07641435e9d49686c3eefd9d698caf1b2115dd (patch) | |
tree | 8a2be41c3c087cbd60e0546f4ac80f7734537835 /spec/features | |
parent | fcc810a1d91d0c2e6cf9726b943e06ee64b97a60 (diff) | |
download | gitlab-ce-ec07641435e9d49686c3eefd9d698caf1b2115dd.tar.gz |
Fix an error in projects admin when statistics are missing
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_sees_project_statistics_spec.rb | 29 | ||||
-rw-r--r-- | spec/features/admin/admin_sees_projects_statistics_spec.rb | 20 |
2 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb new file mode 100644 index 00000000000..95d1fc5b57a --- /dev/null +++ b/spec/features/admin/admin_sees_project_statistics_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe "Admin > Admin sees project statistics" do + let(:current_user) { create(:admin) } + + before do + sign_in(current_user) + + visit admin_project_path(project) + end + + context 'when project has statistics' do + let(:project) { create(:project, :repository) } + + it "shows project statistics" do + expect(page).to have_content("Storage: 0 Bytes (0 Bytes repositories, 0 Bytes build artifacts, 0 Bytes LFS)") + end + end + + context 'when project has no statistics' do + let(:project) { create(:project, :repository) { |project| project.statistics.destroy } } + + it "shows 'Storage: Unknown'" do + expect(page).to have_content("Storage: Unknown") + end + end +end diff --git a/spec/features/admin/admin_sees_projects_statistics_spec.rb b/spec/features/admin/admin_sees_projects_statistics_spec.rb new file mode 100644 index 00000000000..6a6f369ac7c --- /dev/null +++ b/spec/features/admin/admin_sees_projects_statistics_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe "Admin > Admin sees projects statistics" do + let(:current_user) { create(:admin) } + + before do + create(:project, :repository) + create(:project, :repository) { |project| project.statistics.destroy } + + sign_in(current_user) + + visit admin_projects_path + end + + it "shows project statistics for projects that have them" do + expect(page.all('.stats').map(&:text)).to contain_exactly("0 Bytes", "Unknown") + end +end |