Rebase on master

Trying to retrigger travis
Change-Id: Ifd86fb4c6b2791ad176230254fbf69a9ade979fb
This commit is contained in:
Izaak Alpert 2013-06-26 16:45:57 -04:00
parent bbef8bb589
commit 09112dbb1d
5 changed files with 21 additions and 11 deletions

View file

@ -105,11 +105,11 @@ class MergeRequest < ActiveRecord::Base
end end
if opened? || reopened? if opened? || reopened?
similar_mrs = self.project.merge_requests.where(source_branch: source_branch, target_branch: target_branch).opened similar_mrs = self.target_project.merge_requests.where(source_branch: source_branch, target_branch: target_branch, source_project_id: source_project.id).opened
similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id
if similar_mrs.any? if similar_mrs.any?
errors.add :base, "There is already an open merge request for this branches" errors.add :base, "Cannot Create: This merge request already exists: #{similar_mrs.pluck(:title)}"
end end
end end
end end

View file

@ -1,6 +1,5 @@
class MergeRequestObserver < ActivityObserver class MergeRequestObserver < ActivityObserver
observe :merge_request observe :merge_request
cattr_accessor :current_user
def after_create(merge_request) def after_create(merge_request)
event_author_id = merge_request.author_id event_author_id = merge_request.author_id

View file

@ -57,11 +57,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
And 'I submit new merge request "Wiki Feature"' do And 'I submit new merge request "Wiki Feature"' do
fill_in "merge_request_title", :with => "Wiki Feature" #this must come first, so that the target branch is set by the time the "select" for "notes_refactoring" is executed
select project.path_with_namespace, :from => "merge_request_target_project_id" select project.path_with_namespace, :from => "merge_request_target_project_id"
fill_in "merge_request_title", :with => "Wiki Feature"
select "master", :from => "merge_request_source_branch" select "master", :from => "merge_request_source_branch"
select "stable", :from => "merge_request_target_branch" find(:select, "merge_request_target_project_id", {}).value.should == project.id.to_s
find(:select, "merge_request_target_branch", {}).find(:option, "stable", {}).value.should == "stable" find(:select, "merge_request_source_project_id", {}).value.should == project.id.to_s
#using "notes_refactoring" because "Bug NS-04" uses master/stable, this will fail merge_request validation if the branches are the same
find(:select, "merge_request_target_branch", {}).find(:option, "notes_refactoring", {}).value.should == "notes_refactoring"
select "notes_refactoring", :from => "merge_request_target_branch"
click_button "Submit merge request" click_button "Submit merge request"
end end

View file

@ -9,7 +9,7 @@ describe FilterContext do
let(:merge_request1) { create(:merge_request, author_id: user.id, source_project: project1, target_project: project2) } let(:merge_request1) { create(:merge_request, author_id: user.id, source_project: project1, target_project: project2) }
let(:merge_request2) { create(:merge_request, author_id: user.id, source_project: project2, target_project: project1) } let(:merge_request2) { create(:merge_request, author_id: user.id, source_project: project2, target_project: project1) }
let(:merge_request3) { create(:merge_request, author_id: user.id, source_project: project2, target_project: project2) } let(:merge_request3) { create(:merge_request, author_id: user.id, source_project: project2, target_project: project2) }
let(:merge_request4) { create(:merge_request, author_id: user2.id, source_project: project2, target_project: project2) } let(:merge_request4) { create(:merge_request, author_id: user2.id, source_project: project2, target_project: project2, target_branch:"notes_refactoring") }
let(:issue1) { create(:issue, assignee_id: user.id, project: project1) } let(:issue1) { create(:issue, assignee_id: user.id, project: project1) }
let(:issue2) { create(:issue, assignee_id: user.id, project: project2) } let(:issue2) { create(:issue, assignee_id: user.id, project: project2) }
let(:issue3) { create(:issue, assignee_id: user2.id, project: project2) } let(:issue3) { create(:issue, assignee_id: user2.id, project: project2) }

View file

@ -232,11 +232,16 @@ describe NotificationService do
end end
end end
let(:u_watcher) { create(:user, notification_level: Notification::N_WATCH) }
let(:u_participating) { create(:user, notification_level: Notification::N_PARTICIPATING) }
let(:u_disabled) { create(:user, notification_level: Notification::N_DISABLED) }
let(:u_mentioned) { create(:user, username: 'mention', notification_level: Notification::N_WATCH) }
def build_team(project) def build_team(project)
@u_watcher = create(:user, notification_level: Notification::N_WATCH) @u_watcher = u_watcher
@u_participating = create(:user, notification_level: Notification::N_PARTICIPATING) @u_participating = u_participating
@u_disabled = create(:user, notification_level: Notification::N_DISABLED) @u_disabled = u_disabled
@u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_WATCH) @u_mentioned = u_mentioned
project.team << [@u_watcher, :master] project.team << [@u_watcher, :master]
project.team << [@u_participating, :master] project.team << [@u_participating, :master]