summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2016-07-21 16:49:43 -0400
committerAlejandro Rodríguez <alejorro70@gmail.com>2016-07-21 18:00:16 -0400
commit065a65adfe3508581664358779821b802476ee0d (patch)
treeb1d2e5399b387ae0fbb6d00539f119daea43ff7e /spec
parentd2598f6273d4a714134c26ee520b99a40579e8fa (diff)
downloadgitlab-ce-065a65adfe3508581664358779821b802476ee0d.tar.gz
Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects
Diffstat (limited to 'spec')
-rw-r--r--spec/models/repository_spec.rb26
1 files changed, 6 insertions, 20 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 38b0c345b48..3e133143bbc 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -50,8 +50,9 @@ describe Repository, models: true do
double_first = double(committed_date: Time.now)
double_last = double(committed_date: Time.now - 1.second)
- allow(repository).to receive(:commit).with(tag_a.target).and_return(double_first)
- allow(repository).to receive(:commit).with(tag_b.target).and_return(double_last)
+ allow(tag_a).to receive(:target).and_return(double_first)
+ allow(tag_b).to receive(:target).and_return(double_last)
+ allow(repository).to receive(:tags).and_return([tag_a, tag_b])
end
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
@@ -64,8 +65,9 @@ describe Repository, models: true do
double_first = double(committed_date: Time.now - 1.second)
double_last = double(committed_date: Time.now)
- allow(repository).to receive(:commit).with(tag_a.target).and_return(double_last)
- allow(repository).to receive(:commit).with(tag_b.target).and_return(double_first)
+ allow(tag_a).to receive(:target).and_return(double_last)
+ allow(tag_b).to receive(:target).and_return(double_first)
+ allow(repository).to receive(:tags).and_return([tag_a, tag_b])
end
it { is_expected.to eq(['v1.1.0', 'v1.0.0']) }
@@ -1161,17 +1163,6 @@ describe Repository, models: true do
end
end
- describe '#local_branches' do
- it 'returns the local branches' do
- masterrev = repository.find_branch('master').target
- create_remote_branch('joe', 'remote_branch', masterrev)
- repository.add_branch(user, 'local_branch', masterrev)
-
- expect(repository.local_branches.any? { |branch| branch.name == 'remote_branch' }).to eq(false)
- expect(repository.local_branches.any? { |branch| branch.name == 'local_branch' }).to eq(true)
- end
- end
-
describe "#keep_around" do
it "stores a reference to the specified commit sha so it isn't garbage collected" do
repository.keep_around(sample_commit.id)
@@ -1179,9 +1170,4 @@ describe Repository, models: true do
expect(repository.kept_around?(sample_commit.id)).to be_truthy
end
end
-
- def create_remote_branch(remote_name, branch_name, target)
- rugged = repository.rugged
- rugged.references.create("refs/remotes/#{remote_name}/#{branch_name}", target)
- end
end