Commit 17fc18ec authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Check for all possible timeago strings that can be rendered in a few minutes....

Check for all possible timeago strings that can be rendered in a few minutes. We cannot rely on 'less than a minute ago'
parent 6386e42f
...@@ -67,6 +67,9 @@ describe 'Comments on personal snippets', :js, feature: true do ...@@ -67,6 +67,9 @@ describe 'Comments on personal snippets', :js, feature: true do
end end
context 'when editing a note' do context 'when editing a note' do
# Matches `less than a minute ago`, `about a minute ago` and `N minutes ago`
let(:timeago_regex) { /((less than|about) a minute|\d+? minutes) ago/ }
it 'changes the text' do it 'changes the text' do
page.within("#notes-list li#note_#{snippet_notes[0].id}") do page.within("#notes-list li#note_#{snippet_notes[0].id}") do
click_on 'Edit comment' click_on 'Edit comment'
...@@ -80,7 +83,7 @@ describe 'Comments on personal snippets', :js, feature: true do ...@@ -80,7 +83,7 @@ describe 'Comments on personal snippets', :js, feature: true do
page.within("#notes-list li#note_#{snippet_notes[0].id}") do page.within("#notes-list li#note_#{snippet_notes[0].id}") do
expect(page).to have_css('.note_edited_ago') expect(page).to have_css('.note_edited_ago')
expect(page).to have_content('new content') expect(page).to have_content('new content')
expect(find('.note_edited_ago').text).to match(/less than a minute ago/) expect(find('.note_edited_ago').text).to match(timeago_regex)
end end
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