summaryrefslogtreecommitdiff
path: root/spec/helpers/sidebars_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/sidebars_helper_spec.rb')
-rw-r--r--spec/helpers/sidebars_helper_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/helpers/sidebars_helper_spec.rb b/spec/helpers/sidebars_helper_spec.rb
index 6db955f3637..299e4cb0133 100644
--- a/spec/helpers/sidebars_helper_spec.rb
+++ b/spec/helpers/sidebars_helper_spec.rb
@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe SidebarsHelper do
+ include Devise::Test::ControllerHelpers
+
describe '#sidebar_tracking_attributes_by_object' do
subject { helper.sidebar_tracking_attributes_by_object(object) }
@@ -42,4 +44,26 @@ RSpec.describe SidebarsHelper do
end
end
end
+
+ describe '#super_sidebar_context' do
+ let(:user) { build(:user) }
+
+ subject { helper.super_sidebar_context(user) }
+
+ it 'returns sidebar values from user', :use_clean_rails_memory_store_caching do
+ Rails.cache.write(['users', user.id, 'assigned_open_issues_count'], 1)
+ Rails.cache.write(['users', user.id, 'assigned_open_merge_requests_count'], 2)
+ Rails.cache.write(['users', user.id, 'todos_pending_count'], 3)
+
+ expect(subject).to eq({
+ name: user.name,
+ username: user.username,
+ avatar_url: user.avatar_url,
+ assigned_open_issues_count: 1,
+ assigned_open_merge_requests_count: 2,
+ todos_pending_count: 3,
+ issues_dashboard_path: issues_dashboard_path(assignee_username: user.username)
+ })
+ end
+ end
end