Commit 61d4410b authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge remote-tracking branch 'upstream/master' into fix-download-artifacts-button-link

* upstream/master:
  Reset pushes_since_gc counter before specs run to ensure starting point is 0
  Add missing spec for ProtectedBranches::CreateService
  Refactor boards_spec.rb to avoid code duplication
  Render invalid template for merge requests without source project and open
parents cc51e76e 661c464c
......@@ -428,6 +428,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def validates_merge_request
# If source project was removed and merge request for some reason
# wasn't close (Ex. mr from fork to origin)
return invalid_mr if !@merge_request.source_project && @merge_request.open?
# Show git not found page
# if there is no saved commits between source & target branch
if @merge_request.commits.blank?
......
This diff is collapsed.
......@@ -4,6 +4,10 @@ describe Projects::HousekeepingService do
subject { Projects::HousekeepingService.new(project) }
let(:project) { create :project }
before do
project.reset_pushes_since_gc
end
after do
project.reset_pushes_since_gc
end
......
require 'spec_helper'
describe ProtectedBranches::CreateService, services: true do
let(:project) { create(:empty_project) }
let(:user) { project.owner }
let(:params) do
{
name: 'master',
merge_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ],
push_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ]
}
end
describe '#execute' do
subject(:service) { described_class.new(project, user, params) }
it 'creates a new protected branch' do
expect { service.execute }.to change(ProtectedBranch, :count).by(1)
expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
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