diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-21 17:49:06 -0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-22 12:13:46 +0200 |
commit | 5a9ede472150ec78f8410ae15cf782095c8f056c (patch) | |
tree | 5cbdbfb971329960011e8b3a3544e583f9551f6c /spec/models/commit_spec.rb | |
parent | dad88568f34bfda5f7fe34672bc5099c80226138 (diff) | |
download | gitlab-ce-5a9ede472150ec78f8410ae15cf782095c8f056c.tar.gz |
Update mock and stub syntax for specs
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 27eb02a870b..e303a97e6b5 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -77,13 +77,13 @@ eos let(:other_issue) { create :issue, project: other_project } it 'detects issues that this commit is marked as closing' do - commit.stub(safe_message: "Fixes ##{issue.iid}") + allow(commit).to receive(:safe_message).and_return("Fixes ##{issue.iid}") expect(commit.closes_issues).to eq([issue]) end it 'does not detect issues from other projects' do ext_ref = "#{other_project.path_with_namespace}##{other_issue.iid}" - commit.stub(safe_message: "Fixes #{ext_ref}") + allow(commit).to receive(:safe_message).and_return("Fixes #{ext_ref}") expect(commit.closes_issues).to be_empty end end @@ -93,7 +93,9 @@ eos let(:author) { create(:user, email: commit.author_email) } let(:backref_text) { "commit #{subject.id}" } - let(:set_mentionable_text) { ->(txt){ subject.stub(safe_message: txt) } } + let(:set_mentionable_text) do + ->(txt) { allow(subject).to receive(:safe_message).and_return(txt) } + end # Include the subject in the repository stub. let(:extra_commits) { [subject] } |