From f1937f6928cad3122fc9b90b066152cbaf9e692e Mon Sep 17 00:00:00 2001 From: Stephen Crosby Date: Sat, 19 Sep 2015 17:14:31 -0700 Subject: [PATCH] fixes #947 time distance method interface --- app/views/problems/show.html.haml | 2 +- spec/views/problems/show.html.haml_spec.rb | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/views/problems/show.html.haml b/app/views/problems/show.html.haml index cbca417..d1a7ae3 100644 --- a/app/views/problems/show.html.haml +++ b/app/views/problems/show.html.haml @@ -37,7 +37,7 @@ = link_to comment.user.email, comment.user - else %span.comment-info - = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]" + = time_ago_in_words(comment.created_at, include_seconds: true) << " ago by [Unknown User]" %span.delete= link_to '✘'.html_safe, [app, problem, comment], :method => :delete, :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment" %tr diff --git a/spec/views/problems/show.html.haml_spec.rb b/spec/views/problems/show.html.haml_spec.rb index 14ea145..375a89e 100644 --- a/spec/views/problems/show.html.haml_spec.rb +++ b/spec/views/problems/show.html.haml_spec.rb @@ -164,7 +164,7 @@ describe "problems/show.html.haml", type: 'view' do allow(Errbit::Config).to receive(:use_gravatar).and_return(true) end - it 'should display comments and new comment form' do + it 'displays comments and new comment form' do render expect(view.content_for(:comments)).to include('Test comment') @@ -172,12 +172,26 @@ describe "problems/show.html.haml", type: 'view' do expect(view.content_for(:comments)).to include('Add a comment') end - it 'should display existing comments with configured tracker' do + it 'displays existing comments with configured tracker' do with_issue_tracker("pivotal", problem) render expect(view.content_for(:comments)).to include('Test comment') expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') end + + it 'displays comment when comment has no user' do + with_issue_tracker("pivotal", problem) + + first_comment = view.problem.comments.first + first_comment.user.destroy + first_comment.reload + + render + + expect(view.content_for(:comments)).to include('Test comment') + expect(view.content_for(:comments)).to include('Unknown User') + expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') + end end end -- libgit2 0.21.2