Commit 554baec9 authored by Katarzyna Kobierska's avatar Katarzyna Kobierska

Add method

parent 81da7f13
......@@ -327,6 +327,13 @@ class MergeRequest < ActiveRecord::Base
!source_project.forked_from?(target_project)
end
def can_reopen?
return false if closed_without_fork? || closed_without_source_project?
return true if closed?
# false
end
def ensure_merge_request_diff
merge_request_diff || create_merge_request_diff
end
......
......@@ -1076,4 +1076,17 @@ describe MergeRequest, models: true do
end
end
end
describe '#can_reopen?' do
it "returns true" do
subject.close
binding.pry
expect(subject.can_reopen?).to be_truthy
end
it "returns false" do
expect(subject.can_reopen?).to be_falsey
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