diff options
author | Rémy Coutable <remy@rymai.me> | 2018-01-05 19:23:06 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-05 19:23:06 +0000 |
commit | a2aad0535642baecb093855574618dae43465e3a (patch) | |
tree | 179fa8ddf5b6de23d99ccf5bca4ff9ecf153850c /spec | |
parent | 89f174daa5c6565215aa986671cd6dba9fbc0a41 (diff) | |
parent | 0b07be594e932cd9eb135b82e10931495350cb21 (diff) | |
download | gitlab-ce-a2aad0535642baecb093855574618dae43465e3a.tar.gz |
Merge branch 'gitaly-multi-action-prep' into 'master'
Move git operations for multi_action into Gitlab::Git
Closes gitaly#872
See merge request gitlab-org/gitlab-ce!16215
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 46 | ||||
-rw-r--r-- | spec/services/files/multi_service_spec.rb | 4 |
2 files changed, 9 insertions, 41 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 48a75c9885b..c0db2c1b386 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -582,38 +582,6 @@ describe Repository do end end - describe '#get_committer_and_author' do - it 'returns the committer and author data' do - options = repository.get_committer_and_author(user) - expect(options[:committer][:email]).to eq(user.email) - expect(options[:author][:email]).to eq(user.email) - end - - context 'when the email/name are given' do - it 'returns an object containing the email/name' do - options = repository.get_committer_and_author(user, email: author_email, name: author_name) - expect(options[:author][:email]).to eq(author_email) - expect(options[:author][:name]).to eq(author_name) - end - end - - context 'when the email is given but the name is not' do - it 'returns the committer as the author' do - options = repository.get_committer_and_author(user, email: author_email) - expect(options[:author][:email]).to eq(user.email) - expect(options[:author][:name]).to eq(user.name) - end - end - - context 'when the name is given but the email is not' do - it 'returns nil' do - options = repository.get_committer_and_author(user, name: author_name) - expect(options[:author][:email]).to eq(user.email) - expect(options[:author][:name]).to eq(user.name) - end - end - end - describe "search_files_by_content" do let(:results) { repository.search_files_by_content('feature', 'master') } subject { results } @@ -1112,16 +1080,16 @@ describe Repository do allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, '']) end - it 'expires branch cache' do - expect(repository).not_to receive(:expire_exists_cache) - expect(repository).not_to receive(:expire_root_ref_cache) - expect(repository).not_to receive(:expire_emptiness_caches) - expect(repository).to receive(:expire_branches_cache) - - repository.with_branch(user, 'new-feature') do + subject do + Gitlab::Git::OperationService.new(git_user, repository.raw_repository).with_branch('new-feature') do new_rev end end + + it 'returns branch_created as true' do + expect(subject).not_to be_repo_created + expect(subject).to be_branch_created + end end context 'when repository is empty' do diff --git a/spec/services/files/multi_service_spec.rb b/spec/services/files/multi_service_spec.rb index 2b79609930c..b9971776b33 100644 --- a/spec/services/files/multi_service_spec.rb +++ b/spec/services/files/multi_service_spec.rb @@ -41,7 +41,7 @@ describe Files::MultiService do describe '#execute' do context 'with a valid action' do - it 'returns a hash with the :success status ' do + it 'returns a hash with the :success status' do results = subject.execute expect(results[:status]).to eq(:success) @@ -51,7 +51,7 @@ describe Files::MultiService do context 'with an invalid action' do let(:action) { 'rename' } - it 'returns a hash with the :error status ' do + it 'returns a hash with the :error status' do results = subject.execute expect(results[:status]).to eq(:error) |