summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/views
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/admin/application_settings/_package_registry.html.haml_spec.rb12
-rw-r--r--spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb47
-rw-r--r--spec/views/groups/show.html.haml_spec.rb52
-rw-r--r--spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb4
-rw-r--r--spec/views/notify/change_in_merge_request_draft_status_email.html.haml_spec.rb19
-rw-r--r--spec/views/notify/change_in_merge_request_draft_status_email.text.erb_spec.rb20
-rw-r--r--spec/views/projects/_home_panel.html.haml_spec.rb10
-rw-r--r--spec/views/projects/commit/_commit_box.html.haml_spec.rb27
-rw-r--r--spec/views/projects/empty.html.haml_spec.rb37
-rw-r--r--spec/views/projects/issues/import_csv/_button.html.haml_spec.rb43
-rw-r--r--spec/views/projects/merge_requests/show.html.haml_spec.rb38
-rw-r--r--spec/views/projects/settings/operations/show.html.haml_spec.rb4
-rw-r--r--spec/views/projects/show.html.haml_spec.rb51
-rw-r--r--spec/views/shared/snippets/_snippet.html.haml_spec.rb52
14 files changed, 175 insertions, 241 deletions
diff --git a/spec/views/admin/application_settings/_package_registry.html.haml_spec.rb b/spec/views/admin/application_settings/_package_registry.html.haml_spec.rb
index ef40829c29b..e0aa2fc8d56 100644
--- a/spec/views/admin/application_settings/_package_registry.html.haml_spec.rb
+++ b/spec/views/admin/application_settings/_package_registry.html.haml_spec.rb
@@ -30,8 +30,8 @@ RSpec.describe 'admin/application_settings/_package_registry' do
expect(rendered).to have_field('Maximum Maven package file size in bytes', type: 'number')
expect(page.find_field('Maximum Maven package file size in bytes').value).to eq(default_plan_limits.maven_max_file_size.to_s)
- expect(rendered).to have_field('Maximum NPM package file size in bytes', type: 'number')
- expect(page.find_field('Maximum NPM package file size in bytes').value).to eq(default_plan_limits.npm_max_file_size.to_s)
+ expect(rendered).to have_field('Maximum npm package file size in bytes', type: 'number')
+ expect(page.find_field('Maximum npm package file size in bytes').value).to eq(default_plan_limits.npm_max_file_size.to_s)
expect(rendered).to have_field('Maximum NuGet package file size in bytes', type: 'number')
expect(page.find_field('Maximum NuGet package file size in bytes').value).to eq(default_plan_limits.nuget_max_file_size.to_s)
@@ -48,18 +48,18 @@ RSpec.describe 'admin/application_settings/_package_registry' do
end
context 'with multiple plans' do
- let_it_be(:plan) { create(:plan, name: 'Gold') }
- let_it_be(:gold_plan_limits) { create(:plan_limits, :with_package_file_sizes, plan: plan) }
+ let_it_be(:plan) { create(:plan, name: 'Ultimate') }
+ let_it_be(:ultimate_plan_limits) { create(:plan_limits, :with_package_file_sizes, plan: plan) }
before do
- assign(:plans, [default_plan_limits.plan, gold_plan_limits.plan])
+ assign(:plans, [default_plan_limits.plan, ultimate_plan_limits.plan])
end
it 'displays the plan name when there is more than one plan' do
subject
expect(page).to have_content('Default')
- expect(page).to have_content('Gold')
+ expect(page).to have_content('Ultimate')
end
end
end
diff --git a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb
index 2915fe1964f..dc8f259eb56 100644
--- a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb
+++ b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb
@@ -3,34 +3,49 @@
require 'spec_helper'
RSpec.describe 'admin/application_settings/_repository_storage.html.haml' do
- let(:app_settings) { create(:application_setting) }
- let(:repository_storages_weighted_attributes) { [:repository_storages_weighted_default, :repository_storages_weighted_mepmep, :repository_storages_weighted_foobar]}
- let(:repository_storages_weighted) do
- {
- "default" => 100,
- "mepmep" => 50
- }
- end
+ let(:app_settings) { build(:application_setting, repository_storages_weighted: repository_storages_weighted) }
before do
- allow(app_settings).to receive(:repository_storages_weighted).and_return(repository_storages_weighted)
- allow(app_settings).to receive(:repository_storages_weighted_mepmep).and_return(100)
- allow(app_settings).to receive(:repository_storages_weighted_foobar).and_return(50)
+ stub_storage_settings({ 'default': {}, 'mepmep': {}, 'foobar': {} })
assign(:application_setting, app_settings)
- allow(ApplicationSetting).to receive(:repository_storages_weighted_attributes).and_return(repository_storages_weighted_attributes)
end
- context 'when multiple storages are available' do
+ context 'additional storage config' do
+ let(:repository_storages_weighted) do
+ {
+ 'default' => 100,
+ 'mepmep' => 50
+ }
+ end
+
it 'lists them all' do
render
- # lists storages that are saved with weights
- repository_storages_weighted.each do |storage_name, storage_weight|
+ Gitlab.config.repositories.storages.keys.each do |storage_name|
expect(rendered).to have_content(storage_name)
end
- # lists storage not saved with weight
expect(rendered).to have_content('foobar')
end
end
+
+ context 'fewer storage configs' do
+ let(:repository_storages_weighted) do
+ {
+ 'default' => 100,
+ 'mepmep' => 50,
+ 'something_old' => 100
+ }
+ end
+
+ it 'lists only configured storages' do
+ render
+
+ Gitlab.config.repositories.storages.keys.each do |storage_name|
+ expect(rendered).to have_content(storage_name)
+ end
+
+ expect(rendered).not_to have_content('something_old')
+ end
+ end
end
diff --git a/spec/views/groups/show.html.haml_spec.rb b/spec/views/groups/show.html.haml_spec.rb
deleted file mode 100644
index a53aab43c18..00000000000
--- a/spec/views/groups/show.html.haml_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'groups/show.html.haml' do
- let_it_be(:user) { build(:user) }
- let_it_be(:group) { create(:group) }
-
- before do
- assign(:group, group)
- end
-
- context 'when rendering with the layout' do
- subject(:render_page) { render template: 'groups/show.html.haml', layout: 'layouts/group' }
-
- describe 'invite team members' do
- before do
- allow(view).to receive(:session).and_return({})
- allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
- allow(view).to receive(:current_user).and_return(user)
- allow(view).to receive(:experiment_enabled?).and_return(false)
- allow(view).to receive(:group_path).and_return('')
- allow(view).to receive(:group_shared_path).and_return('')
- allow(view).to receive(:group_archived_path).and_return('')
- end
-
- context 'when invite team members is not available in sidebar' do
- before do
- allow(view).to receive(:can_invite_members_for_group?).and_return(false)
- end
-
- it 'does not display the js-invite-members-trigger' do
- render_page
-
- expect(rendered).not_to have_selector('.js-invite-members-trigger')
- end
- end
-
- context 'when invite team members is available' do
- before do
- allow(view).to receive(:can_invite_members_for_group?).and_return(true)
- end
-
- it 'includes the div for js-invite-members-trigger' do
- render_page
-
- expect(rendered).to have_selector('.js-invite-members-trigger')
- end
- end
- end
- end
-end
diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
index e34d8b91b38..99d7dfc8acb 100644
--- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'does not show the ci/cd settings tab' do
render
- expect(rendered).not_to have_link('CI / CD', href: project_settings_ci_cd_path(project))
+ expect(rendered).not_to have_link('CI/CD', href: project_settings_ci_cd_path(project))
end
end
@@ -214,7 +214,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'shows the ci/cd settings tab' do
render
- expect(rendered).to have_link('CI / CD', href: project_settings_ci_cd_path(project))
+ expect(rendered).to have_link('CI/CD', href: project_settings_ci_cd_path(project))
end
end
end
diff --git a/spec/views/notify/change_in_merge_request_draft_status_email.html.haml_spec.rb b/spec/views/notify/change_in_merge_request_draft_status_email.html.haml_spec.rb
new file mode 100644
index 00000000000..6c25eba03b9
--- /dev/null
+++ b/spec/views/notify/change_in_merge_request_draft_status_email.html.haml_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'notify/change_in_merge_request_draft_status_email.html.haml' do
+ let(:user) { create(:user) }
+ let(:merge_request) { create(:merge_request) }
+
+ before do
+ assign(:updated_by_user, user)
+ assign(:merge_request, merge_request)
+ end
+
+ it 'renders the email correctly' do
+ render
+
+ expect(rendered).to have_content("#{user.name} changed the draft status of merge request #{merge_request.to_reference}")
+ end
+end
diff --git a/spec/views/notify/change_in_merge_request_draft_status_email.text.erb_spec.rb b/spec/views/notify/change_in_merge_request_draft_status_email.text.erb_spec.rb
new file mode 100644
index 00000000000..a05c20fd8c4
--- /dev/null
+++ b/spec/views/notify/change_in_merge_request_draft_status_email.text.erb_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+RSpec.describe 'notify/change_in_merge_request_draft_status_email.text.erb' do
+ let(:user) { create(:user) }
+ let(:merge_request) { create(:merge_request) }
+
+ before do
+ assign(:updated_by_user, user)
+ assign(:merge_request, merge_request)
+ end
+
+ it_behaves_like 'renders plain text email correctly'
+
+ it 'renders the email correctly' do
+ render
+
+ expect(rendered).to have_content("#{user.name} changed the draft status of merge request #{merge_request.to_reference}")
+ end
+end
diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb
index cc0eb9919da..d329c57af00 100644
--- a/spec/views/projects/_home_panel.html.haml_spec.rb
+++ b/spec/views/projects/_home_panel.html.haml_spec.rb
@@ -9,7 +9,6 @@ RSpec.describe 'projects/_home_panel' do
let(:project) { create(:project) }
before do
- stub_feature_flags(vue_notification_dropdown: false)
assign(:project, project)
allow(view).to receive(:current_user).and_return(user)
@@ -25,11 +24,10 @@ RSpec.describe 'projects/_home_panel' do
assign(:notification_setting, notification_settings)
end
- it 'makes it possible to set notification level' do
+ it 'renders Vue app root' do
render
- expect(view).to render_template('shared/notifications/_new_button')
- expect(rendered).to have_selector('.notification-dropdown')
+ expect(rendered).to have_selector('.js-vue-notification-dropdown')
end
end
@@ -40,10 +38,10 @@ RSpec.describe 'projects/_home_panel' do
assign(:notification_setting, nil)
end
- it 'is not possible to set notification level' do
+ it 'does not render Vue app root' do
render
- expect(rendered).not_to have_selector('.notification_dropdown')
+ expect(rendered).not_to have_selector('.js-vue-notification-dropdown')
end
end
end
diff --git a/spec/views/projects/commit/_commit_box.html.haml_spec.rb b/spec/views/projects/commit/_commit_box.html.haml_spec.rb
index 9c97696493e..9d18519ade6 100644
--- a/spec/views/projects/commit/_commit_box.html.haml_spec.rb
+++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb
@@ -21,12 +21,37 @@ RSpec.describe 'projects/commit/_commit_box.html.haml' do
end
context 'when there is a pipeline present' do
+ context 'when pipeline has stages' do
+ before do
+ pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success')
+ create(:ci_build, pipeline: pipeline, stage: 'build')
+
+ assign(:last_pipeline, project.commit.last_pipeline)
+ end
+
+ it 'shows pipeline stages in vue' do
+ render
+
+ expect(rendered).to have_selector('.js-commit-pipeline-mini-graph')
+ end
+
+ it 'shows pipeline stages in haml when feature flag is disabled' do
+ stub_feature_flags(ci_commit_pipeline_mini_graph_vue: false)
+
+ render
+
+ expect(rendered).to have_selector('.js-commit-pipeline-graph')
+ end
+ end
+
context 'when there are multiple pipelines for a commit' do
it 'shows the last pipeline' do
create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success')
create(:ci_pipeline, project: project, sha: project.commit.id, status: 'canceled')
third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'failed')
+ assign(:last_pipeline, third_pipeline)
+
render
expect(rendered).to have_text("Pipeline ##{third_pipeline.id} failed")
@@ -40,6 +65,8 @@ RSpec.describe 'projects/commit/_commit_box.html.haml' do
end
it 'shows correct pipeline description' do
+ assign(:last_pipeline, pipeline)
+
render
expect(rendered).to have_text "Pipeline ##{pipeline.id} " \
diff --git a/spec/views/projects/empty.html.haml_spec.rb b/spec/views/projects/empty.html.haml_spec.rb
index 6762dcd22d5..de83722160e 100644
--- a/spec/views/projects/empty.html.haml_spec.rb
+++ b/spec/views/projects/empty.html.haml_spec.rb
@@ -79,41 +79,4 @@ RSpec.describe 'projects/empty' do
it_behaves_like 'no invite member info'
end
end
-
- context 'when rendering with the layout' do
- subject(:render_page) { render template: 'projects/empty.html.haml', layout: 'layouts/project' }
-
- describe 'invite team members' do
- before do
- allow(view).to receive(:session).and_return({})
- allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
- allow(view).to receive(:current_user).and_return(user)
- allow(view).to receive(:experiment_enabled?).and_return(false)
- end
-
- context 'when invite team members is not available in sidebar' do
- before do
- allow(view).to receive(:can_invite_members_for_project?).and_return(false)
- end
-
- it 'does not display the js-invite-members-trigger' do
- render_page
-
- expect(rendered).not_to have_selector('.js-invite-members-trigger')
- end
- end
-
- context 'when invite team members is available' do
- before do
- allow(view).to receive(:can_invite_members_for_project?).and_return(true)
- end
-
- it 'includes the div for js-invite-members-trigger' do
- render_page
-
- expect(rendered).to have_selector('.js-invite-members-trigger')
- end
- end
- end
- end
end
diff --git a/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb b/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb
deleted file mode 100644
index 8bc0a00d71c..00000000000
--- a/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'projects/issues/import_csv/_button' do
- include Devise::Test::ControllerHelpers
-
- context 'when the user does not have edit permissions' do
- before do
- render
- end
-
- it 'shows a dropdown button to import CSV' do
- expect(rendered).to have_text('Import CSV')
- end
-
- it 'does not show a button to import from Jira' do
- expect(rendered).not_to have_text('Import from Jira')
- end
- end
-
- context 'when the user has edit permissions' do
- let(:project) { create(:project) }
- let(:current_user) { create(:user, maintainer_projects: [project]) }
-
- before do
- allow(view).to receive(:project_import_jira_path).and_return('import/jira')
- allow(view).to receive(:current_user).and_return(current_user)
-
- assign(:project, project)
-
- render
- end
-
- it 'shows a dropdown button to import CSV' do
- expect(rendered).to have_text('Import CSV')
- end
-
- it 'shows a button to import from Jira' do
- expect(rendered).to have_text('Import from Jira')
- end
- end
-end
diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb
index db41c9b5374..40d11342ec4 100644
--- a/spec/views/projects/merge_requests/show.html.haml_spec.rb
+++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb
@@ -2,16 +2,14 @@
require 'spec_helper'
-RSpec.describe 'projects/merge_requests/show.html.haml' do
- include Spec::Support::Helpers::Features::MergeRequestHelpers
+RSpec.describe 'projects/merge_requests/show.html.haml', :aggregate_failures do
+ include_context 'merge request show action'
before do
- allow(view).to receive(:experiment_enabled?).and_return(false)
+ merge_request.reload
end
context 'when the merge request is open' do
- include_context 'open merge request show action'
-
it 'shows the "Mark as draft" button' do
render
@@ -22,20 +20,8 @@ RSpec.describe 'projects/merge_requests/show.html.haml' do
end
context 'when the merge request is closed' do
- include_context 'closed merge request show action'
-
- describe 'merge request assignee sidebar' do
- context 'when assignee is allowed to merge' do
- it 'does not show a warning icon' do
- closed_merge_request.update!(assignee_id: user.id)
- project.add_maintainer(user)
- assign(:issuable_sidebar, serialize_issuable_sidebar(user, project, closed_merge_request))
-
- render
-
- expect(rendered).not_to have_css('.merge-icon')
- end
- end
+ before do
+ merge_request.close!
end
it 'shows the "Reopen" button' do
@@ -46,15 +32,15 @@ RSpec.describe 'projects/merge_requests/show.html.haml' do
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
- it 'does not show the "Reopen" button when the source project does not exist' do
- unlink_project.execute
- closed_merge_request.reload
- preload_view_requirements(closed_merge_request, note)
+ context 'when source project does not exist' do
+ it 'does not show the "Reopen" button' do
+ allow(merge_request).to receive(:source_project).and_return(nil)
- render
+ render
- expect(rendered).to have_css('a', visible: false, text: 'Reopen')
- expect(rendered).to have_css('a', visible: false, text: 'Close')
+ expect(rendered).to have_css('a', visible: false, text: 'Reopen')
+ expect(rendered).to have_css('a', visible: false, text: 'Close')
+ end
end
end
end
diff --git a/spec/views/projects/settings/operations/show.html.haml_spec.rb b/spec/views/projects/settings/operations/show.html.haml_spec.rb
index a22853d40d8..b2dd3556098 100644
--- a/spec/views/projects/settings/operations/show.html.haml_spec.rb
+++ b/spec/views/projects/settings/operations/show.html.haml_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe 'projects/settings/operations/show' do
expect(rendered).to have_content _('Prometheus')
expect(rendered).to have_content _('Link Prometheus monitoring to GitLab.')
- expect(rendered).to have_content _('To enable the installation of Prometheus on your clusters, deactivate the manual configuration below')
+ expect(rendered).to have_content _('To enable the installation of Prometheus on your clusters, deactivate the manual configuration.')
end
end
@@ -71,7 +71,7 @@ RSpec.describe 'projects/settings/operations/show' do
it 'renders the Operations Settings page' do
render
- expect(rendered).not_to have_content _('Select the Active checkbox to override the Auto Configuration with custom settings. If unchecked, Auto Configuration settings are used.')
+ expect(rendered).not_to have_content _('Auto configuration settings are used unless you override their values here.')
end
end
end
diff --git a/spec/views/projects/show.html.haml_spec.rb b/spec/views/projects/show.html.haml_spec.rb
deleted file mode 100644
index 995e31e83af..00000000000
--- a/spec/views/projects/show.html.haml_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'projects/show.html.haml' do
- let_it_be(:user) { build(:user) }
- let_it_be(:project) { ProjectPresenter.new(create(:project, :repository), current_user: user) }
-
- before do
- assign(:project, project)
- end
-
- context 'when rendering with the layout' do
- subject(:render_page) { render template: 'projects/show.html.haml', layout: 'layouts/project' }
-
- describe 'invite team members' do
- before do
- allow(view).to receive(:event_filter_link)
- allow(view).to receive(:session).and_return({})
- allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
- allow(view).to receive(:current_user).and_return(user)
- allow(view).to receive(:experiment_enabled?).and_return(false)
- allow(view).to receive(:add_page_startup_graphql_call)
- end
-
- context 'when invite team members is not available in sidebar' do
- before do
- allow(view).to receive(:can_invite_members_for_project?).and_return(false)
- end
-
- it 'does not display the js-invite-members-trigger' do
- render_page
-
- expect(rendered).not_to have_selector('.js-invite-members-trigger')
- end
- end
-
- context 'when invite team members is available' do
- before do
- allow(view).to receive(:can_invite_members_for_project?).and_return(true)
- end
-
- it 'includes the div for js-invite-members-trigger' do
- render_page
-
- expect(rendered).to have_selector('.js-invite-members-trigger')
- end
- end
- end
- end
-end
diff --git a/spec/views/shared/snippets/_snippet.html.haml_spec.rb b/spec/views/shared/snippets/_snippet.html.haml_spec.rb
new file mode 100644
index 00000000000..712021ec1e1
--- /dev/null
+++ b/spec/views/shared/snippets/_snippet.html.haml_spec.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'shared/snippets/_snippet.html.haml' do
+ let_it_be(:snippet) { create(:snippet) }
+
+ before do
+ allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
+ allow(view).to receive(:can?) { true }
+
+ @noteable_meta_data = Class.new { include Gitlab::NoteableMetadata }.new.noteable_meta_data([snippet], 'Snippet')
+ end
+
+ context 'snippet with statistics' do
+ it 'renders correct file count and tooltip' do
+ snippet.statistics.file_count = 3
+
+ render 'shared/snippets/snippet', snippet: snippet
+
+ expect(rendered).to have_selector("span.file_count", text: '3')
+ expect(rendered).to have_selector("span.file_count[title=\"3 files\"]")
+ end
+
+ it 'renders correct file count and tooltip when file_count is 1' do
+ snippet.statistics.file_count = 1
+
+ render 'shared/snippets/snippet', snippet: snippet
+
+ expect(rendered).to have_selector("span.file_count", text: '1')
+ expect(rendered).to have_selector("span.file_count[title=\"1 file\"]")
+ end
+
+ it 'does not render file count when file count is 0' do
+ snippet.statistics.file_count = 0
+
+ render 'shared/snippets/snippet', snippet: snippet
+
+ expect(rendered).not_to have_selector('span.file_count')
+ end
+ end
+
+ context 'snippet without statistics' do
+ it 'does not render file count if statistics are not present' do
+ snippet.statistics = nil
+
+ render 'shared/snippets/snippet', snippet: snippet
+
+ expect(rendered).not_to have_selector('span.file_count')
+ end
+ end
+end