diff options
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d97866d695d..aa3d7478234 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1312,12 +1312,25 @@ describe Project, models: true do end context 'using a forked repository' do - it 'does nothing' do - expect(project).to receive(:forked?).and_return(true) + before do + allow(project).to receive(:forked?).and_return(true) + end + + it 'does not create the repository if the force flag is false' do expect(shell).not_to receive(:add_repository) project.create_repository end + + it 'creates the repository if the force flag is true' do + expect(shell).to receive(:add_repository). + with(project.repository_storage_path, project.path_with_namespace). + and_return(true) + + expect(project.repository).to receive(:after_create) + + expect(project.create_repository(force: true)).to eq(true) + end end end |