diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-10-06 14:49:59 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-10-06 14:49:59 +0000 |
commit | 9a13f885a9dc7b072d41160a6d3db965c9114b4b (patch) | |
tree | 5becd7566eae9f65806e99035fe3651579e27b44 /spec/services/boards | |
parent | dcfda304aa8c06f427cb5672ceb4e070047436be (diff) | |
parent | 8ad923695e54c7ac6e9c47c37c505a7ac6b34017 (diff) | |
download | gitlab-ce-9a13f885a9dc7b072d41160a6d3db965c9114b4b.tar.gz |
Merge branch 'issue-boards-new-issue' into 'master'
Issue boards new issue form
## What does this MR do?
Adds a new issue form into the issue boards lists.
## Screenshots (if relevant)
![Screen_Shot_2016-10-03_at_14.57.30](/uploads/17fe6cd37bd020a2ee1688e0b496c18f/Screen_Shot_2016-10-03_at_14.57.30.png)
![Screen_Shot_2016-10-03_at_14.57.32](/uploads/c3f12bcb9ff9a0e7ce5b0bb06dfb0dd7/Screen_Shot_2016-10-03_at_14.57.32.png)
## What are the relevant issue numbers?
Part of #21219
See merge request !6653
Diffstat (limited to 'spec/services/boards')
-rw-r--r-- | spec/services/boards/issues/create_service_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/services/boards/issues/create_service_spec.rb b/spec/services/boards/issues/create_service_spec.rb new file mode 100644 index 00000000000..33e10e79f6d --- /dev/null +++ b/spec/services/boards/issues/create_service_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe Boards::Issues::CreateService, services: true do + describe '#execute' do + let(:project) { create(:project_with_board) } + let(:board) { project.board } + let(:user) { create(:user) } + let(:label) { create(:label, project: project, name: 'in-progress') } + let!(:list) { create(:list, board: board, label: label, position: 0) } + + subject(:service) { described_class.new(project, user, title: 'New issue') } + + before do + project.team << [user, :developer] + end + + it 'delegates the create proceedings to Issues::CreateService' do + expect_any_instance_of(Issues::CreateService).to receive(:execute).once + + service.execute(list) + end + + it 'creates a new issue' do + expect { service.execute(list) }.to change(project.issues, :count).by(1) + end + + it 'adds the label of the list to the issue' do + issue = service.execute(list) + + expect(issue.labels).to eq [label] + end + end +end |