Commit f1937f6928cad3122fc9b90b066152cbaf9e692e
1 parent
00cb61dd
Exists in
master
and in
1 other branch
fixes #947 time distance method interface
Showing
2 changed files
with
17 additions
and
3 deletions
Show diff stats
app/views/problems/show.html.haml
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | = link_to comment.user.email, comment.user | 37 | = link_to comment.user.email, comment.user |
38 | - else | 38 | - else |
39 | %span.comment-info | 39 | %span.comment-info |
40 | - = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]" | 40 | + = time_ago_in_words(comment.created_at, include_seconds: true) << " ago by [Unknown User]" |
41 | %span.delete= link_to '✘'.html_safe, [app, problem, comment], :method => :delete, | 41 | %span.delete= link_to '✘'.html_safe, [app, problem, comment], :method => :delete, |
42 | :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment" | 42 | :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment" |
43 | %tr | 43 | %tr |
spec/views/problems/show.html.haml_spec.rb
@@ -164,7 +164,7 @@ describe "problems/show.html.haml", type: 'view' do | @@ -164,7 +164,7 @@ describe "problems/show.html.haml", type: 'view' do | ||
164 | allow(Errbit::Config).to receive(:use_gravatar).and_return(true) | 164 | allow(Errbit::Config).to receive(:use_gravatar).and_return(true) |
165 | end | 165 | end |
166 | 166 | ||
167 | - it 'should display comments and new comment form' do | 167 | + it 'displays comments and new comment form' do |
168 | render | 168 | render |
169 | 169 | ||
170 | expect(view.content_for(:comments)).to include('Test comment') | 170 | expect(view.content_for(:comments)).to include('Test comment') |
@@ -172,12 +172,26 @@ describe "problems/show.html.haml", type: 'view' do | @@ -172,12 +172,26 @@ describe "problems/show.html.haml", type: 'view' do | ||
172 | expect(view.content_for(:comments)).to include('Add a comment') | 172 | expect(view.content_for(:comments)).to include('Add a comment') |
173 | end | 173 | end |
174 | 174 | ||
175 | - it 'should display existing comments with configured tracker' do | 175 | + it 'displays existing comments with configured tracker' do |
176 | with_issue_tracker("pivotal", problem) | 176 | with_issue_tracker("pivotal", problem) |
177 | render | 177 | render |
178 | 178 | ||
179 | expect(view.content_for(:comments)).to include('Test comment') | 179 | expect(view.content_for(:comments)).to include('Test comment') |
180 | expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') | 180 | expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') |
181 | end | 181 | end |
182 | + | ||
183 | + it 'displays comment when comment has no user' do | ||
184 | + with_issue_tracker("pivotal", problem) | ||
185 | + | ||
186 | + first_comment = view.problem.comments.first | ||
187 | + first_comment.user.destroy | ||
188 | + first_comment.reload | ||
189 | + | ||
190 | + render | ||
191 | + | ||
192 | + expect(view.content_for(:comments)).to include('Test comment') | ||
193 | + expect(view.content_for(:comments)).to include('Unknown User') | ||
194 | + expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') | ||
195 | + end | ||
182 | end | 196 | end |
183 | end | 197 | end |