summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/reference_parser/commit_parser_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 06:06:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 06:06:16 +0000
commit0282449e6ea95b54b32acfd2de24c8c5f64a8165 (patch)
tree017b43b103e45ff571d637a5efc77b5ed25c0686 /spec/lib/banzai/reference_parser/commit_parser_spec.rb
parent0ecdcf59f4342de55a7d2c3ee4ac0d9c3b116aa5 (diff)
downloadgitlab-ce-0282449e6ea95b54b32acfd2de24c8c5f64a8165.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai/reference_parser/commit_parser_spec.rb')
-rw-r--r--spec/lib/banzai/reference_parser/commit_parser_spec.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/spec/lib/banzai/reference_parser/commit_parser_spec.rb b/spec/lib/banzai/reference_parser/commit_parser_spec.rb
index eac1cf16a8f..7f7c750fe74 100644
--- a/spec/lib/banzai/reference_parser/commit_parser_spec.rb
+++ b/spec/lib/banzai/reference_parser/commit_parser_spec.rb
@@ -35,8 +35,9 @@ describe Banzai::ReferenceParser::CommitParser do
it 'returns an Array of commits' do
commit = double(:commit)
- allow_any_instance_of(Project).to receive(:valid_repo?)
- .and_return(true)
+ allow_next_instance_of(Project) do |instance|
+ allow(instance).to receive(:valid_repo?).and_return(true)
+ end
expect(subject).to receive(:find_commits)
.with(project, ['123'])
@@ -46,8 +47,9 @@ describe Banzai::ReferenceParser::CommitParser do
end
it 'returns an empty Array when the commit could not be found' do
- allow_any_instance_of(Project).to receive(:valid_repo?)
- .and_return(true)
+ allow_next_instance_of(Project) do |instance|
+ allow(instance).to receive(:valid_repo?).and_return(true)
+ end
expect(subject).to receive(:find_commits)
.with(project, ['123'])
@@ -57,8 +59,9 @@ describe Banzai::ReferenceParser::CommitParser do
end
it 'skips projects without valid repositories' do
- allow_any_instance_of(Project).to receive(:valid_repo?)
- .and_return(false)
+ allow_next_instance_of(Project) do |instance|
+ allow(instance).to receive(:valid_repo?).and_return(false)
+ end
expect(subject.referenced_by([link])).to eq([])
end
@@ -66,8 +69,9 @@ describe Banzai::ReferenceParser::CommitParser do
context 'when the link does not have a data-commit attribute' do
it 'returns an empty Array' do
- allow_any_instance_of(Project).to receive(:valid_repo?)
- .and_return(true)
+ allow_next_instance_of(Project) do |instance|
+ allow(instance).to receive(:valid_repo?).and_return(true)
+ end
expect(subject.referenced_by([link])).to eq([])
end
@@ -76,8 +80,9 @@ describe Banzai::ReferenceParser::CommitParser do
context 'when the link does not have a data-project attribute' do
it 'returns an empty Array' do
- allow_any_instance_of(Project).to receive(:valid_repo?)
- .and_return(true)
+ allow_next_instance_of(Project) do |instance|
+ allow(instance).to receive(:valid_repo?).and_return(true)
+ end
expect(subject.referenced_by([link])).to eq([])
end