diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-06-10 01:12:00 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-06-10 01:23:19 +0300 |
commit | f2dee8e8555409d3b1d333703581c6d62166cf83 (patch) | |
tree | 6096261b6d7aa2d15f1c51f8c3e671f19ff40782 /spec/helpers/todos_helper_spec.rb | |
parent | b16730fc8317b282d5dc86dbc8936c74303f5a36 (diff) |
Test todos_count_format helper at the correct level to improve speed
Instead of an integration test that creates 101 Todo records to test a
simple view helper, just unit test the helper.
Diffstat (limited to 'spec/helpers/todos_helper_spec.rb')
-rw-r--r-- | spec/helpers/todos_helper_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/helpers/todos_helper_spec.rb b/spec/helpers/todos_helper_spec.rb index 50060a0925d..18a41ca24e3 100644 --- a/spec/helpers/todos_helper_spec.rb +++ b/spec/helpers/todos_helper_spec.rb @@ -1,6 +1,19 @@ require "spec_helper" describe TodosHelper do + describe '#todos_count_format' do + it 'shows fuzzy count for 100 or more items' do + expect(helper.todos_count_format(100)).to eq '99+' + expect(helper.todos_count_format(1000)).to eq '99+' + end + + it 'shows exact count for 99 or fewer items' do + expect(helper.todos_count_format(99)).to eq '99' + expect(helper.todos_count_format(50)).to eq '50' + expect(helper.todos_count_format(1)).to eq '1' + end + end + describe '#todo_projects_options' do let(:projects) { create_list(:empty_project, 3) } let(:user) { create(:user) } |