Commit 651ff7df authored by James Fargher's avatar James Fargher

Use table-driven spec

parent c2a219d1
...@@ -709,27 +709,23 @@ describe QuickActions::InterpretService do ...@@ -709,27 +709,23 @@ describe QuickActions::InterpretService do
end end
context 'submit_review command' do context 'submit_review command' do
let(:merge_request) { create(:merge_request, source_project: project) } using RSpec::Parameterized::TableSyntax
let(:content) { '/submit_review' }
let!(:draft_note) { create(:draft_note, note: note, merge_request: merge_request, author: current_user) }
before do where(:note) do
stub_licensed_features(batch_comments: true) [
'I like it',
'/submit_review'
]
end end
context 'note has normal text' do with_them do
let(:note) { 'I like it' } let(:merge_request) { create(:merge_request, source_project: project) }
let(:content) { '/submit_review' }
it 'submits the users current review' do let!(:draft_note) { create(:draft_note, note: note, merge_request: merge_request, author: current_user) }
_, _, message = service.execute(content, merge_request)
expect { draft_note.reload }.to raise_error(ActiveRecord::RecordNotFound) before do
expect(message).to eq('Submitted the current review.') stub_licensed_features(batch_comments: true)
end end
end
context 'note has /submit_review' do
let(:note) { '/submit_review' }
it 'submits the users current review' do it 'submits the users current review' do
_, _, message = service.execute(content, merge_request) _, _, message = service.execute(content, merge_request)
......
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