diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-05-04 20:56:11 +0200 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-06-02 10:38:08 -0600 |
commit | 5b322f0276878470f573c84e1f5bb4d27997f522 (patch) | |
tree | 1cc0d64248de9c8901572d146a2e1e5e7c350b10 /spec | |
parent | 47e67f3cc2dc395c887f4e8693ad224876519826 (diff) | |
download | gitlab-ce-make_issue_from_line_comment.tar.gz |
Notes can be used to create a new issuemake_issue_from_line_comment
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/notes/create_service_spec.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index ff23f13e1cb..1e59ffa05bf 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -14,7 +14,7 @@ describe Notes::CreateService, services: true do noteable_type: 'Issue', noteable_id: issue.id } - + @note = Notes::CreateService.new(project, user, opts).execute end @@ -23,6 +23,38 @@ describe Notes::CreateService, services: true do end end + describe "#new_issue" do + let(:content) do + <<-NOTE + My new title + --- + This is my body + NOTE + end + let(:merge_request) { create(:merge_request) } + let(:params) { {note: content, noteable_type: "MergeRequest", noteable_id: merge_request.id} } + + before do + project.team << [user, :master] + end + + it "creates a new issue" do + expect { Notes::CreateService.new(project, user, params).new_issue }.to change { Issue.count }.by(1) + end + + it 'sets a bota a note and a reference' do + expect { Notes::CreateService.new(project, user, params).new_issue }.to change { Note.count }.by(2) + end + + it "parses the note" do + Notes::CreateService.new(project, user, params).new_issue + new_issue = Issue.last + + expect(new_issue.title).to eq 'My new title' + expect(new_issue.description).to eq 'This is my body' + end + end + describe "award emoji" do before do project.team << [user, :master] |