Commit ea9c7bee authored by Peter Leitzen's avatar Peter Leitzen

Fix preview of commit tagging

parent 82337dd6
......@@ -24,8 +24,6 @@ module QuickActions
end
def commit(type_id)
return nil unless type_id
project.commit(type_id)
end
end
......
......@@ -32,5 +32,15 @@ describe 'Commit > User uses quick actions', :js do
expect(page).to have_content tag_message
expect(page).to have_content truncated_commit_sha
end
describe 'preview', :js do
it 'removes quick action from note and explains it' do
preview_note("/tag #{tag_name} #{tag_message}")
expect(page).not_to have_content '/tag'
expect(page).to have_content %{Tags this commit to #{tag_name} with "#{tag_message}"}
expect(page).to have_content tag_name
end
end
end
end
......@@ -57,13 +57,19 @@ describe QuickActions::TargetService do
context 'for commit' do
let(:project) { create(:project, :repository) }
let(:target) { project.commit }
let(:target) { project.commit.parent }
let(:target_id) { target.sha }
let(:type) { 'Commit' }
it_behaves_like 'find target'
it_behaves_like 'no target', type_id: 'invalid_sha'
it_behaves_like 'no target', type_id: nil
context 'with nil target_id' do
let(:target) { project.commit }
let(:target_id) { nil }
it_behaves_like 'find target'
end
end
context 'for unknown type' do
......
......@@ -20,6 +20,13 @@ module Spec
end
end
end
def preview_note(text)
page.within('.js-main-target-form') do
fill_in('note[note]', with: text)
click_on('Preview')
end
end
end
end
end
......
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