Commit 2beea778 authored by David Pisek's avatar David Pisek Committed by Lin Jen-Shin

Add sidenav test to dependencies controller

This commit adds a test to the dependencies controller that checks
if the correct sidenavigation is active.

It also chages a spec helper to support both `response.body` and
`page` objects.
parent 3c768ddb
......@@ -16,6 +16,8 @@ describe Projects::DependenciesController do
end
context 'when feature is available' do
render_views
before do
stub_licensed_features(dependency_list: true)
end
......@@ -26,6 +28,12 @@ describe Projects::DependenciesController do
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
end
it 'renders the side navigation with the correct submenu set as active' do
subject
expect(response.body).to have_active_sub_navigation('Dependency List')
end
end
context 'when feature is not available' do
......
......@@ -9,6 +9,6 @@ end
RSpec::Matchers.define :have_active_sub_navigation do |expected|
match do |page|
expect(page.find('.sidebar-sub-level-items > li.active:not(.fly-out-top-item)')).to have_content(expected)
expect(page).to have_css('.sidebar-sub-level-items > li.active:not(.fly-out-top-item)', text: expected)
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