debian-mirror-gitlab/spec/features/projects/remote_mirror_spec.rb

43 lines
1.2 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Project remote mirror', :feature do
2018-10-15 14:42:47 +05:30
let(:project) { create(:project, :repository, :remote_mirror) }
let(:remote_mirror) { project.remote_mirrors.first }
let(:user) { create(:user) }
describe 'On a project', :js do
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2018-10-15 14:42:47 +05:30
sign_in user
end
context 'when last_error is present but last_update_at is not' do
it 'renders error message without timstamp' do
2018-11-18 11:00:15 +05:30
remote_mirror.update(last_error: 'Some new error', last_update_at: nil)
2018-10-15 14:42:47 +05:30
visit project_mirror_path(project)
2018-11-20 20:47:30 +05:30
expect_mirror_to_have_error_and_timeago('Never')
2018-10-15 14:42:47 +05:30
end
end
context 'when last_error and last_update_at are present' do
it 'renders error message with timestamp' do
2018-11-18 11:00:15 +05:30
remote_mirror.update(last_error: 'Some new error', last_update_at: Time.now - 5.minutes)
2018-10-15 14:42:47 +05:30
visit project_mirror_path(project)
2018-11-20 20:47:30 +05:30
expect_mirror_to_have_error_and_timeago('5 minutes ago')
2018-10-15 14:42:47 +05:30
end
end
2018-11-20 20:47:30 +05:30
def expect_mirror_to_have_error_and_timeago(timeago)
row = first('.js-mirrors-table-body tr')
expect(row).to have_content('Error')
expect(row).to have_content(timeago)
end
2018-10-15 14:42:47 +05:30
end
end