Commit 9b598fa6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix MR fork validation and services load

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 9ee697dd
......@@ -127,7 +127,9 @@ class MergeRequest < ActiveRecord::Base
end
def validate_fork
if target_projet == source_project
return true unless target_project && source_project
if target_project == source_project
true
else
# If source and target projects are different
......
module MergeReques
module MergeRequests
class CreateService < MergeRequests::BaseService
def execute
merge_request = MergeRequest.new(params)
......
require_relative 'base_service'
require_relative 'reopen_service'
require_relative 'close_service'
module MergeRequests
class UpdateService < MergeRequests::BaseService
def execute(merge_request)
......
......@@ -53,15 +53,15 @@ class DashboardMergeRequests < Spinach::FeatureSteps
end
def assigned_merge_request
@assigned_merge_request ||= create :merge_request, assignee: current_user, target_project: project
@assigned_merge_request ||= create :merge_request, assignee: current_user, target_project: project, source_project: project
end
def authored_merge_request
@authored_merge_request ||= create :merge_request, author: current_user, target_project: project
@authored_merge_request ||= create :merge_request, source_branch: 'simple_merge_request', author: current_user, target_project: project, source_project: project
end
def other_merge_request
@other_merge_request ||= create :merge_request, target_project: project
@other_merge_request ||= create :merge_request, source_branch: '2_3_notes_fix', target_project: project, source_project: project
end
def project
......
......@@ -52,6 +52,4 @@ Spinach.hooks.before_run do
RSpec::Mocks::setup self
include FactoryGirl::Syntax::Methods
MergeRequestObserver.any_instance.stub(current_user: create(:user))
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