diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-15 12:27:40 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-15 12:27:40 +0300 |
commit | 2a53d6c21aed285ce08a4c4431154e9182beb069 (patch) | |
tree | a7feb47aac68f7a96411d8e28c9fec4968acc1c2 /spec/services/delete_branch_service_spec.rb | |
parent | a88b2d3b019cd696404d20f8042a555ec0081143 (diff) |
Add minimial test coverage for delete branch service
Diffstat (limited to 'spec/services/delete_branch_service_spec.rb')
-rw-r--r-- | spec/services/delete_branch_service_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/delete_branch_service_spec.rb b/spec/services/delete_branch_service_spec.rb new file mode 100644 index 00000000000..2603a930a08 --- /dev/null +++ b/spec/services/delete_branch_service_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe DeleteBranchService, services: true do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:service) { described_class.new(project, user) } + + describe '#execute' do + let(:result) { service.execute('feature') } + + context 'when user has access to push to repository' do + before do + project.team << [user, :developer] + end + + it 'removes the branch' do + expect(result[:status]).to eq :success + end + end + + context 'when user does not have access to push to repository' do + it 'does not remove branch' do + expect(result[:status]).to eq :error + expect(result[:message]).to eq 'You dont have push access to repo' + end + end + end +end |