Commit 26b9d8fe authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Add helper tests

parent 91d88d10
...@@ -179,7 +179,7 @@ module SearchHelper ...@@ -179,7 +179,7 @@ module SearchHelper
elsif @group.present? elsif @group.present?
@group.full_path @group.full_path
else else
root_dashboard_path 'dashboard'
end end
end end
......
...@@ -135,5 +135,40 @@ describe SearchHelper do ...@@ -135,5 +135,40 @@ describe SearchHelper do
expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/groups#{group_path(@group)}") expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/groups#{group_path(@group)}")
end end
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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment