gitlab-org--gitlab-foss/spec/services/merge_requests/create_service_spec.rb
Dmitriy Zaporozhets 3e259ea8bc Revert "Merge branch 'revert-satellites' into 'master' "
This reverts commit 5daf44b7c8, reversing
changes made to 2f706fbd23.
2015-08-11 14:33:31 +02:00

34 lines
906 B
Ruby

require 'spec_helper'
describe MergeRequests::CreateService do
let(:project) { create(:project) }
let(:user) { create(:user) }
describe :execute do
context 'valid params' do
let(:opts) do
{
title: 'Awesome merge_request',
description: 'please fix',
source_branch: 'feature',
target_branch: 'master'
}
end
let(:service) { MergeRequests::CreateService.new(project, user, opts) }
before do
project.team << [user, :master]
allow(service).to receive(:execute_hooks)
@merge_request = service.execute
end
it { expect(@merge_request).to be_valid }
it { expect(@merge_request.title).to eq('Awesome merge_request') }
it 'should execute hooks with default action' do
expect(service).to have_received(:execute_hooks).with(@merge_request)
end
end
end
end