From 37bbdb604c89ce3a17ad56eb03bf3c8d5be3bc4f Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 6 Jan 2017 20:17:37 +0000 Subject: Added spec for testing the issuable count --- .../shared/milestones/_issuables.html.haml.rb | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 spec/views/shared/milestones/_issuables.html.haml.rb (limited to 'spec/views') diff --git a/spec/views/shared/milestones/_issuables.html.haml.rb b/spec/views/shared/milestones/_issuables.html.haml.rb new file mode 100644 index 00000000000..4769d569548 --- /dev/null +++ b/spec/views/shared/milestones/_issuables.html.haml.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'shared/milestones/_issuables.html.haml' do + let(:issuables_size) { 100 } + + before do + allow(view).to receive_messages(title: nil, id: nil, show_project_name: nil, + show_full_project_name: nil, dom_class: '', + issuables: double(size: issuables_size).as_null_object) + + stub_template 'shared/milestones/_issuable.html.haml' => '' + end + + it 'should show the issuables count if show_counter is true' do + render 'shared/milestones/issuables', show_counter: true + expect(rendered).to have_content('100') + end + + it 'should not show the issuables count if show_counter is false' do + 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 } + + it 'should show a delimited number if show_counter is true' do + render 'shared/milestones/issuables', show_counter: true + expect(rendered).to have_content('1,000') + end + end +end -- cgit v1.2.3