diff options
author | James Lopez <james@jameslopez.es> | 2016-07-12 16:21:28 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-07-12 16:21:28 +0200 |
commit | ad6ff2238045d6b7873144eb302aa953c9f1fc66 (patch) | |
tree | debebcedf6f9c3950daf4e16b51d200203df1e01 /spec/models | |
parent | b7ba5fa06bfb434c9227a2175f936fc31fd3444f (diff) | |
download | gitlab-ce-ad6ff2238045d6b7873144eb302aa953c9f1fc66.tar.gz |
fixes a few issues to do with import_url not being saved correctly for imports. This should prevent the import_data to be created when it should not and output an error properly validating before creating it.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 5a27ccbab0a..d6bb8d0d54f 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -130,17 +130,35 @@ describe Project, models: true do end end - it 'should not allow an invalid URI as import_url' do + it 'does not allow an invalid URI as import_url' do project2 = build(:project, import_url: 'invalid://') expect(project2).not_to be_valid end - it 'should allow a valid URI as import_url' do + it 'does allow a valid URI as import_url' do project2 = build(:project, import_url: 'ssh://test@gitlab.com/project.git') expect(project2).to be_valid end + + it 'does not allow to introduce an empty URI' do + project2 = build(:project, import_url: '') + + expect(project2).not_to be_valid + end + + it 'does not produce import data on an empty URI' do + project2 = build(:project, import_url: '') + + expect(project2.import_data).to be_nil + end + + it 'does not produce import data on an invalid URI' do + project2 = build(:project, import_url: 'test://') + + expect(project2.import_data).to be_nil + end end describe 'default_scope' do |