Commit 7fa36610 authored by Lucas Deschamps's avatar Lucas Deschamps

Improve issuables_counter_spec relevance.

parent 677af1dd
require 'spec_helper' require 'spec_helper'
describe 'Navigation bar counter', feature: true, js: true, caching: true do describe 'Navigation bar counter', feature: true, js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
login_as(user) login_as(user)
visit issues_dashboard_path
end end
it 'reflects dashboard issues count' do it 'reflects dashboard issues count' do
create(:issue, project: project, assignee: user) issue = create(:issue, project: project, assignee: user)
visit issues_dashboard_path
dashboard_count = find('li.active span.badge')
nav_count = find('.dashboard-shortcuts-issues span.count')
expect(nav_count).to have_content('1')
expect(dashboard_count).to have_content('1')
issue.assignee = nil
visit issues_dashboard_path visit issues_dashboard_path
dashboard_count = find('li.active span.badge') dashboard_count = find('li.active span.badge')
nav_count = find('.dashboard-shortcuts-issues span.count') nav_count = find('.dashboard-shortcuts-issues span.count')
expect(dashboard_count).to have_content('0') expect(nav_count).to have_content('1')
expect(nav_count).to have_content('0') expect(dashboard_count).to have_content('1')
end end
it 'reflects dashboard merge requests count' do it 'reflects dashboard merge requests count' do
create(:merge_request, assignee: user) merge_request = create(:merge_request, source_project: project, assignee: user)
visit merge_requests_dashboard_path
dashboard_count = find('li.active span.badge')
nav_count = find('.dashboard-shortcuts-merge_requests span.count')
expect(nav_count).to have_content('1')
expect(dashboard_count).to have_content('1')
merge_request.assignee = nil
visit merge_requests_dashboard_path visit merge_requests_dashboard_path
dashboard_count = find('li.active span.badge') dashboard_count = find('li.active span.badge')
nav_count = find('.dashboard-shortcuts-merge_requests span.count') nav_count = find('.dashboard-shortcuts-merge_requests span.count')
expect(dashboard_count).to have_content('0') expect(nav_count).to have_content('1')
expect(nav_count).to have_content('0') expect(dashboard_count).to have_content('1')
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