Commit e1b78c36 authored by George Koltsov's avatar George Koltsov

Add MergeRequest#diff_refs spec

parent 19dcb081
......@@ -2454,6 +2454,13 @@ describe MergeRequest do
describe "#diff_refs" do
context "with diffs" do
subject { create(:merge_request, :with_diffs) }
let(:expected_diff_refs) {
Gitlab::Diff::DiffRefs.new(
base_sha: subject.merge_request_diff.base_commit_sha,
start_sha: subject.merge_request_diff.start_commit_sha,
head_sha: subject.merge_request_diff.head_commit_sha
)
}
it "does not touch the repository" do
subject # Instantiate the object
......@@ -2464,14 +2471,18 @@ describe MergeRequest do
end
it "returns expected diff_refs" do
expected_diff_refs = Gitlab::Diff::DiffRefs.new(
base_sha: subject.merge_request_diff.base_commit_sha,
start_sha: subject.merge_request_diff.start_commit_sha,
head_sha: subject.merge_request_diff.head_commit_sha
)
expect(subject.diff_refs).to eq(expected_diff_refs)
end
context 'when importing' do
before do
subject.importing = true
end
it "returns MR diff_refs" do
expect(subject.diff_refs).to eq(expected_diff_refs)
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment