Commit a9155ab0 authored by Douwe Maan's avatar Douwe Maan

Merge branch '47208-human-import-status-name-not-working' into 'master'

Resolve "ActionView::Template::Error: undefined method `human_import_status_name"

Closes #47208

See merge request gitlab-org/gitlab-ce!19470
parents 7c374f52 3ed66d4a
......@@ -675,6 +675,12 @@ class Project < ActiveRecord::Base
end
end
def human_import_status_name
ensure_import_state
import_state.human_status_name
end
def import_schedule
ensure_import_state(force: true)
......
---
title: Showing project import_status in a humanized form no longer gives an error
merge_request: 19470
author:
type: fixed
......@@ -1693,6 +1693,31 @@ describe Project do
end
end
describe '#human_import_status_name' do
context 'when import_state exists' do
it 'returns the humanized status name' do
project = create(:project)
create(:import_state, :started, project: project)
expect(project.human_import_status_name).to eq("started")
end
end
context 'when import_state was not created yet' do
let(:project) { create(:project, :import_started) }
it 'ensures import_state is created and returns humanized status name' do
expect do
project.human_import_status_name
end.to change { ProjectImportState.count }.from(0).to(1)
end
it 'returns humanized status name' do
expect(project.human_import_status_name).to eq("started")
end
end
end
describe 'Project import job' do
let(:project) { create(:project, import_url: generate(:url)) }
......
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