diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-06-05 21:12:26 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-06-06 11:21:47 +0300 |
commit | 3ed66d4abde28c9f586342fe8e6481360825b823 (patch) | |
tree | 7ae5f00d518604bbf69b709712dd476591b5e86d /spec/models/project_spec.rb | |
parent | 7e54d0465c9bf7d52a49b08472d7b12d1c655a91 (diff) |
Adds #human_import_status_name to make it comply with ProjectImportState#human_status_name
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 9a76452a808..59d1671b036 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -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)) } |