diff options
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/sidebars_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/users_helper_spec.rb | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/spec/helpers/sidebars_helper_spec.rb b/spec/helpers/sidebars_helper_spec.rb index 318fbea746a..ddfea50a86f 100644 --- a/spec/helpers/sidebars_helper_spec.rb +++ b/spec/helpers/sidebars_helper_spec.rb @@ -98,7 +98,7 @@ RSpec.describe SidebarsHelper, feature_category: :navigation do availability: user.status&.availability.to_s, emoji: user.status&.emoji, message: user.status&.message_html&.html_safe, - clear_after: user.status&.clear_status_at.to_s + clear_after: nil }, trial: { has_start_trial: helper.current_user_menu?(:start_trial), diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb index 41161188388..2829236f7d1 100644 --- a/spec/helpers/users_helper_spec.rb +++ b/spec/helpers/users_helper_spec.rb @@ -37,6 +37,35 @@ RSpec.describe UsersHelper do end end + describe '#user_clear_status_at' do + context 'when status exists' do + context 'with clear_status_at set' do + it 'has the correct iso formatted date', time_travel_to: '2020-01-01 00:00:00 +0000' do + clear_status_at = 1.day.from_now + status = build_stubbed(:user_status, clear_status_at: clear_status_at) + + expect(user_clear_status_at(status.user)).to eq('2020-01-02T00:00:00Z') + end + end + + context 'without clear_status_at set' do + it 'returns nil' do + status = build_stubbed(:user_status, clear_status_at: nil) + + expect(user_clear_status_at(status.user)).to be_nil + end + end + end + + context 'without status' do + it 'returns nil' do + user = build_stubbed(:user) + + expect(user_clear_status_at(user)).to be_nil + end + end + end + describe '#profile_tabs' do subject(:tabs) { helper.profile_tabs } |