BigW Consortium Gitlab

Commit 100cdce2 by Robert Speicher

Make sure time_ago_with_tooltip is using a Time object

Somehow this test existed on EE but not in CE, so it started failing after a bad CE-to-EE merge.
parent d047db91
...@@ -205,7 +205,7 @@ module ApplicationHelper ...@@ -205,7 +205,7 @@ module ApplicationHelper
def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false) def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false)
element = content_tag :time, time.to_s, element = content_tag :time, time.to_s,
class: "#{html_class} js-timeago js-timeago-pending", class: "#{html_class} js-timeago js-timeago-pending",
datetime: time.getutc.iso8601, datetime: time.to_time.getutc.iso8601,
title: time.in_time_zone.to_s(:medium), title: time.in_time_zone.to_s(:medium),
data: { toggle: 'tooltip', placement: placement, container: 'body' } data: { toggle: 'tooltip', placement: placement, container: 'body' }
......
...@@ -285,6 +285,10 @@ describe ApplicationHelper do ...@@ -285,6 +285,10 @@ describe ApplicationHelper do
it 'allows the script tag to be excluded' do it 'allows the script tag to be excluded' do
expect(element(skip_js: true)).not_to include 'script' expect(element(skip_js: true)).not_to include 'script'
end end
it 'converts to Time' do
expect { helper.time_ago_with_tooltip(Date.today) }.not_to raise_error
end
end end
describe 'render_markup' do describe 'render_markup' do
......
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