diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-02-22 21:15:40 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-02-22 21:15:40 -0500 |
commit | 67948368aec144ff7e9997ce184cb4d111622f08 (patch) | |
tree | c94e382fb1aca074b6ce503255564828cb387e36 /spec/models/commit_spec.rb | |
parent | 608012629cc90337aba6c5bd4b2b73b530091fb0 (diff) | |
parent | 7c8099853621cc2a244bf6e0fd37a8b503d1ec5e (diff) | |
download | gitlab-ce-sidebar-sizing-higher-viewport.tar.gz |
Merge branch 'master' into sidebar-sizing-higher-viewportsidebar-sizing-higher-viewport
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index ecf37b40c58..253902512c3 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -118,4 +118,38 @@ eos it { expect(data[:modified]).to eq([".gitmodules"]) } it { expect(data[:removed]).to eq([]) } end + + describe '#reverts_commit?' do + let(:another_commit) { double(:commit, revert_description: "This reverts commit #{commit.sha}") } + + it { expect(commit.reverts_commit?(another_commit)).to be_falsy } + + context 'commit has no description' do + before { allow(commit).to receive(:description?).and_return(false) } + + it { expect(commit.reverts_commit?(another_commit)).to be_falsy } + end + + context "another_commit's description does not revert commit" do + before { allow(commit).to receive(:description).and_return("Foo Bar") } + + it { expect(commit.reverts_commit?(another_commit)).to be_falsy } + end + + context "another_commit's description reverts commit" do + before { allow(commit).to receive(:description).and_return("Foo #{another_commit.revert_description} Bar") } + + it { expect(commit.reverts_commit?(another_commit)).to be_truthy } + end + + context "another_commit's description reverts merged merge request" do + before do + revert_description = "This reverts merge request !foo123" + allow(another_commit).to receive(:revert_description).and_return(revert_description) + allow(commit).to receive(:description).and_return("Foo #{another_commit.revert_description} Bar") + end + + it { expect(commit.reverts_commit?(another_commit)).to be_truthy } + end + end end |