2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'shared/milestones/_issuables.html.haml' do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:issuables_size) { 100 }
|
|
|
|
|
|
|
|
before do
|
2021-01-03 14:25:43 +05:30
|
|
|
allow(view).to receive_messages(title: nil, id: nil, show_project_name: nil, dom_class: '',
|
2019-10-12 21:52:04 +05:30
|
|
|
issuables: double(length: issuables_size).as_null_object)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
stub_template 'shared/milestones/_issuable.html.haml' => ''
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'shows the issuables count if show_counter is true' do
|
2017-08-17 22:00:37 +05:30
|
|
|
render 'shared/milestones/issuables', show_counter: true
|
|
|
|
expect(rendered).to have_content('100')
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'does not show the issuables count if show_counter is false' do
|
2017-08-17 22:00:37 +05:30
|
|
|
render 'shared/milestones/issuables', show_counter: false
|
|
|
|
expect(rendered).not_to have_content('100')
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'a high issuables count' do
|
|
|
|
let(:issuables_size) { 1000 }
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'shows a delimited number if show_counter is true' do
|
2017-08-17 22:00:37 +05:30
|
|
|
render 'shared/milestones/issuables', show_counter: true
|
|
|
|
expect(rendered).to have_content('1,000')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|