Commit 58e5d651 authored by Tiago Botelho's avatar Tiago Botelho

Fix remote mirror last_update_at nil error in view

parent 248ddf26
...@@ -17,7 +17,11 @@ ...@@ -17,7 +17,11 @@
- if @remote_mirror.last_error.present? - if @remote_mirror.last_error.present?
.panel.panel-danger .panel.panel-danger
.panel-heading .panel-heading
- if @remote_mirror.last_update_at
The remote repository failed to update #{time_ago_with_tooltip(@remote_mirror.last_update_at)}. The remote repository failed to update #{time_ago_with_tooltip(@remote_mirror.last_update_at)}.
- else
The remote repository failed to update.
- if @remote_mirror.last_successful_update_at - if @remote_mirror.last_successful_update_at
Last successful update #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}. Last successful update #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}.
.panel-body .panel-body
......
require 'spec_helper'
feature 'Project remote mirror', feature: true do
let(:project) { create(:project, :remote_mirror) }
let(:remote_mirror) { project.remote_mirrors.first }
let(:user) { create(:user) }
describe 'On a project', js: true do
before do
project.team << [user, :master]
sign_in user
end
context 'when last_error is present but last_update_at is not' do
it 'renders error message without timstamp' do
remote_mirror.update_attributes(last_error: 'Some new error', last_update_at: nil)
visit project_mirror_path(project)
expect(page).to have_content('The remote repository failed to update.')
end
end
context 'when last_error and last_update_at are present' do
it 'renders error message with timestamp' do
remote_mirror.update_attributes(last_error: 'Some new error', last_update_at: Time.now - 5.minutes)
visit project_mirror_path(project)
expect(page).to have_content('The remote repository failed to update 5 minutes ago.')
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