diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-07 13:25:08 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-13 15:27:42 +0800 |
commit | 26b9d8fe25e83ac36fe8b397addc40b986a965c0 (patch) | |
tree | fbbe5c0ec4db80cc4ce80b96b457b88c936c543b /spec | |
parent | 91d88d10c7a5608309e83969723409d95d1a34b5 (diff) | |
download | gitlab-ce-26b9d8fe25e83ac36fe8b397addc40b986a965c0.tar.gz |
Add helper tests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/search_helper_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index 8bfd520528f..4945749f524 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -135,5 +135,40 @@ describe SearchHelper do expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/groups#{group_path(@group)}") end end + + context 'dashboard' do + it 'does not include group-id and project-id' do + expect(search_filter_input_options('')[:data]['project-id']).to eq(nil) + expect(search_filter_input_options('')[:data]['group-id']).to eq(nil) + end + + it 'includes dashboard base-endpoint' do + expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/dashboard") + end + end + end + + describe 'search_history_storage_prefix' do + context 'project' do + it 'returns project full_path' do + @project = create(:project, :repository) + + expect(search_history_storage_prefix).to eq(@project.full_path) + end + end + + context 'group' do + it 'returns group full_path' do + @group = create(:group, :nested, name: 'group-name') + + expect(search_history_storage_prefix).to eq(@group.full_path) + end + end + + context 'dashboard' do + it 'returns dashboard' do + expect(search_history_storage_prefix).to eq("dashboard") + end + end end end |