1# frozen_string_literal: true 2 3require 'spec_helper' 4 5RSpec.describe 'shared/milestones/_issuables.html.haml' do 6 let(:issuables_size) { 100 } 7 8 before do 9 allow(view).to receive_messages(title: nil, id: nil, show_project_name: nil, dom_class: '', 10 issuables: double(length: issuables_size).as_null_object) 11 12 stub_template 'shared/milestones/_issuable.html.haml' => '' 13 end 14 15 it 'shows the issuables count if show_counter is true' do 16 render 'shared/milestones/issuables', show_counter: true 17 expect(rendered).to have_content('100') 18 end 19 20 it 'does not show the issuables count if show_counter is false' do 21 render 'shared/milestones/issuables', show_counter: false 22 expect(rendered).not_to have_content('100') 23 end 24 25 describe 'a high issuables count' do 26 let(:issuables_size) { 1000 } 27 28 it 'shows a delimited number if show_counter is true' do 29 render 'shared/milestones/issuables', show_counter: true 30 expect(rendered).to have_content('1,000') 31 end 32 end 33end 34