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