diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-22 16:50:15 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 09:33:05 -0600 |
commit | 1fe7501b49f896b74102c4b970310aa9ae34da85 (patch) | |
tree | ce271afb0fbaaa14291c1dc9009cd7815ee25463 /spec/models/repository_spec.rb | |
parent | bdbc7d967a0c3d95d5e4ea19a2a5be41268d3540 (diff) | |
download | gitlab-ce-1fe7501b49f896b74102c4b970310aa9ae34da85.tar.gz |
Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index dfa019d28b0..a3fe412b229 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -125,8 +125,8 @@ describe Repository, models: true do describe '#ref_name_for_sha' do context 'ref found' do it 'returns the ref' do - allow_any_instance_of(Gitlab::Popen).to receive(:popen) - .and_return(["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0]) + allow_any_instance_of(Gitlab::Popen).to receive(:popen). + and_return(["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0]) expect(repository.ref_name_for_sha('bla', '0' * 40)).to eq 'refs/environments/production/77' end @@ -134,8 +134,8 @@ describe Repository, models: true do context 'ref not found' do it 'returns nil' do - allow_any_instance_of(Gitlab::Popen).to receive(:popen) - .and_return(["", 0]) + allow_any_instance_of(Gitlab::Popen).to receive(:popen). + and_return(["", 0]) expect(repository.ref_name_for_sha('bla', '0' * 40)).to eq nil end @@ -265,8 +265,8 @@ describe Repository, models: true do describe '#commit' do context 'when ref exists' do it 'returns commit object' do - expect(repository.commit('master')) - .to be_an_instance_of Commit + expect(repository.commit('master')). + to be_an_instance_of Commit end end @@ -596,8 +596,8 @@ describe Repository, models: true do user, 'LICENSE', 'Copyright!', message: 'Add LICENSE', branch_name: 'master', update: false) - allow(repository).to receive(:file_on_head) - .and_raise(Rugged::ReferenceError) + allow(repository).to receive(:file_on_head). + and_raise(Rugged::ReferenceError) expect(repository.license_blob).to be_nil end @@ -749,8 +749,8 @@ describe Repository, models: true do context 'when pre hooks were successful' do it 'runs without errors' do - expect_any_instance_of(GitHooksService).to receive(:execute) - .with(user, project.repository.path_to_repo, old_rev, blank_sha, 'refs/heads/feature') + expect_any_instance_of(GitHooksService).to receive(:execute). + with(user, project.repository.path_to_repo, old_rev, blank_sha, 'refs/heads/feature') expect { repository.rm_branch(user, 'feature') }.not_to raise_error end @@ -792,14 +792,14 @@ describe Repository, models: true do before do service = GitHooksService.new expect(GitHooksService).to receive(:new).and_return(service) - expect(service).to receive(:execute) - .with( + expect(service).to receive(:execute). + with( user, repository.path_to_repo, old_rev, new_rev, - 'refs/heads/feature') - .and_yield(service).and_return(true) + 'refs/heads/feature'). + and_yield(service).and_return(true) end it 'runs without errors' do @@ -893,8 +893,8 @@ describe Repository, models: true do expect(repository).not_to receive(:expire_emptiness_caches) expect(repository).to receive(:expire_branches_cache) - GitOperationService.new(user, repository) - .with_branch('new-feature') do + GitOperationService.new(user, repository). + with_branch('new-feature') do new_rev end end @@ -978,8 +978,8 @@ describe Repository, models: true do end it 'does nothing' do - expect(repository.raw_repository).not_to receive(:autocrlf=) - .with(:input) + expect(repository.raw_repository).not_to receive(:autocrlf=). + with(:input) GitOperationService.new(nil, repository).send(:update_autocrlf_option) end @@ -998,9 +998,9 @@ describe Repository, models: true do end it 'caches the output' do - expect(repository.raw_repository).to receive(:empty?) - .once - .and_return(false) + expect(repository.raw_repository).to receive(:empty?). + once. + and_return(false) repository.empty? repository.empty? @@ -1013,9 +1013,9 @@ describe Repository, models: true do end it 'caches the output' do - expect(repository.raw_repository).to receive(:root_ref) - .once - .and_return('master') + expect(repository.raw_repository).to receive(:root_ref). + once. + and_return('master') repository.root_ref repository.root_ref @@ -1026,9 +1026,9 @@ describe Repository, models: true do it 'expires the root reference cache' do repository.root_ref - expect(repository.raw_repository).to receive(:root_ref) - .once - .and_return('foo') + expect(repository.raw_repository).to receive(:root_ref). + once. + and_return('foo') repository.expire_root_ref_cache @@ -1042,17 +1042,17 @@ describe Repository, models: true do let(:cache) { repository.send(:cache) } it 'expires the cache for all branches' do - expect(cache).to receive(:expire) - .at_least(repository.branches.length) - .times + expect(cache).to receive(:expire). + at_least(repository.branches.length). + times repository.expire_branch_cache end it 'expires the cache for all branches when the root branch is given' do - expect(cache).to receive(:expire) - .at_least(repository.branches.length) - .times + expect(cache).to receive(:expire). + at_least(repository.branches.length). + times repository.expire_branch_cache(repository.root_ref) end @@ -1314,12 +1314,12 @@ describe Repository, models: true do describe '#after_push_commit' do it 'expires statistics caches' do - expect(repository).to receive(:expire_statistics_caches) - .and_call_original + expect(repository).to receive(:expire_statistics_caches). + and_call_original - expect(repository).to receive(:expire_branch_cache) - .with('master') - .and_call_original + expect(repository).to receive(:expire_branch_cache). + with('master'). + and_call_original repository.after_push_commit('master') end @@ -1394,9 +1394,9 @@ describe Repository, models: true do describe '#expire_branches_cache' do it 'expires the cache' do - expect(repository).to receive(:expire_method_caches) - .with(%i(branch_names branch_count)) - .and_call_original + expect(repository).to receive(:expire_method_caches). + with(%i(branch_names branch_count)). + and_call_original repository.expire_branches_cache end @@ -1404,9 +1404,9 @@ describe Repository, models: true do describe '#expire_tags_cache' do it 'expires the cache' do - expect(repository).to receive(:expire_method_caches) - .with(%i(tag_names tag_count)) - .and_call_original + expect(repository).to receive(:expire_method_caches). + with(%i(tag_names tag_count)). + and_call_original repository.expire_tags_cache end @@ -1417,11 +1417,11 @@ describe Repository, models: true do let(:user) { build_stubbed(:user) } it 'creates the tag using rugged' do - expect(repository.rugged.tags).to receive(:create) - .with('8.5', repository.commit('master').id, + expect(repository.rugged.tags).to receive(:create). + with('8.5', repository.commit('master').id, hash_including(message: 'foo', - tagger: hash_including(name: user.name, email: user.email))) - .and_call_original + tagger: hash_including(name: user.name, email: user.email))). + and_call_original repository.add_tag(user, '8.5', 'master', 'foo') end @@ -1438,8 +1438,8 @@ describe Repository, models: true do update_hook = Gitlab::Git::Hook.new('update', repository.path_to_repo) post_receive_hook = Gitlab::Git::Hook.new('post-receive', repository.path_to_repo) - allow(Gitlab::Git::Hook).to receive(:new) - .and_return(pre_receive_hook, update_hook, post_receive_hook) + allow(Gitlab::Git::Hook).to receive(:new). + and_return(pre_receive_hook, update_hook, post_receive_hook) allow(pre_receive_hook).to receive(:trigger).and_call_original allow(update_hook).to receive(:trigger).and_call_original @@ -1450,12 +1450,12 @@ describe Repository, models: true do commit_sha = repository.commit('master').id tag_sha = tag.target - expect(pre_receive_hook).to have_received(:trigger) - .with(anything, anything, commit_sha, anything) - expect(update_hook).to have_received(:trigger) - .with(anything, anything, commit_sha, anything) - expect(post_receive_hook).to have_received(:trigger) - .with(anything, anything, tag_sha, anything) + expect(pre_receive_hook).to have_received(:trigger). + with(anything, anything, commit_sha, anything) + expect(update_hook).to have_received(:trigger). + with(anything, anything, commit_sha, anything) + expect(post_receive_hook).to have_received(:trigger). + with(anything, anything, tag_sha, anything) end end @@ -1489,25 +1489,25 @@ describe Repository, models: true do describe '#avatar' do it 'returns nil if repo does not exist' do - expect(repository).to receive(:file_on_head) - .and_raise(Rugged::ReferenceError) + expect(repository).to receive(:file_on_head). + and_raise(Rugged::ReferenceError) expect(repository.avatar).to eq(nil) end it 'returns the first avatar file found in the repository' do - expect(repository).to receive(:file_on_head) - .with(:avatar) - .and_return(double(:tree, path: 'logo.png')) + expect(repository).to receive(:file_on_head). + with(:avatar). + and_return(double(:tree, path: 'logo.png')) expect(repository.avatar).to eq('logo.png') end it 'caches the output' do - expect(repository).to receive(:file_on_head) - .with(:avatar) - .once - .and_return(double(:tree, path: 'logo.png')) + expect(repository).to receive(:file_on_head). + with(:avatar). + once. + and_return(double(:tree, path: 'logo.png')) 2.times { expect(repository.avatar).to eq('logo.png') } end @@ -1567,24 +1567,24 @@ describe Repository, models: true do describe '#contribution_guide', caching: true do it 'returns and caches the output' do - expect(repository).to receive(:file_on_head) - .with(:contributing) - .and_return(Gitlab::Git::Tree.new(path: 'CONTRIBUTING.md')) - .once + expect(repository).to receive(:file_on_head). + with(:contributing). + and_return(Gitlab::Git::Tree.new(path: 'CONTRIBUTING.md')). + once 2.times do - expect(repository.contribution_guide) - .to be_an_instance_of(Gitlab::Git::Tree) + expect(repository.contribution_guide). + to be_an_instance_of(Gitlab::Git::Tree) end end end describe '#gitignore', caching: true do it 'returns and caches the output' do - expect(repository).to receive(:file_on_head) - .with(:gitignore) - .and_return(Gitlab::Git::Tree.new(path: '.gitignore')) - .once + expect(repository).to receive(:file_on_head). + with(:gitignore). + and_return(Gitlab::Git::Tree.new(path: '.gitignore')). + once 2.times do expect(repository.gitignore).to be_an_instance_of(Gitlab::Git::Tree) @@ -1594,10 +1594,10 @@ describe Repository, models: true do describe '#koding_yml', caching: true do it 'returns and caches the output' do - expect(repository).to receive(:file_on_head) - .with(:koding) - .and_return(Gitlab::Git::Tree.new(path: '.koding.yml')) - .once + expect(repository).to receive(:file_on_head). + with(:koding). + and_return(Gitlab::Git::Tree.new(path: '.koding.yml')). + once 2.times do expect(repository.koding_yml).to be_an_instance_of(Gitlab::Git::Tree) @@ -1623,8 +1623,8 @@ describe Repository, models: true do describe '#expire_statistics_caches' do it 'expires the caches' do - expect(repository).to receive(:expire_method_caches) - .with(%i(size commit_count)) + expect(repository).to receive(:expire_method_caches). + with(%i(size commit_count)) repository.expire_statistics_caches end @@ -1641,8 +1641,8 @@ describe Repository, models: true do describe '#expire_all_method_caches' do it 'expires the caches of all methods' do - expect(repository).to receive(:expire_method_caches) - .with(Repository::CACHED_METHODS) + expect(repository).to receive(:expire_method_caches). + with(Repository::CACHED_METHODS) repository.expire_all_method_caches end @@ -1667,8 +1667,8 @@ describe Repository, models: true do context 'with an existing repository' do it 'returns a Gitlab::Git::Tree' do - expect(repository.file_on_head(:readme)) - .to be_an_instance_of(Gitlab::Git::Tree) + expect(repository.file_on_head(:readme)). + to be_an_instance_of(Gitlab::Git::Tree) end end end @@ -1783,8 +1783,8 @@ describe Repository, models: true do describe '#refresh_method_caches' do it 'refreshes the caches of the given types' do - expect(repository).to receive(:expire_method_caches) - .with(%i(readme license_blob license_key)) + expect(repository).to receive(:expire_method_caches). + with(%i(readme license_blob license_key)) expect(repository).to receive(:readme) expect(repository).to receive(:license_blob) |