Merge branch '25979-fix-todos-on-failed-build' into 'master'

Fix viewing "build failed" TODOs

Closes #25979

See merge request !8262
This commit is contained in:
Robert Speicher 2016-12-22 15:56:08 +00:00
commit 8dfa41016b
3 changed files with 21 additions and 1 deletions

View file

@ -35,7 +35,7 @@ module TodosHelper
else else
path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target] path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target]
path.unshift(:builds) if todo.build_failed? path.unshift(:pipelines) if todo.build_failed?
polymorphic_path(path, anchor: anchor) polymorphic_path(path, anchor: anchor)
end end

View file

@ -21,6 +21,7 @@ FactoryGirl.define do
trait :build_failed do trait :build_failed do
action { Todo::BUILD_FAILED } action { Todo::BUILD_FAILED }
target factory: :merge_request
end end
trait :approval_required do trait :approval_required do

View file

@ -155,5 +155,24 @@ describe 'Dashboard Todos', feature: true do
expect(page).to have_selector('.todos-all-done', count: 1) expect(page).to have_selector('.todos-all-done', count: 1)
end end
end end
context 'User has a Build Failed todo' do
let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: author) }
before do
login_as user
visit dashboard_todos_path
end
it 'shows the todo' do
expect(page).to have_content 'The build failed for your merge request'
end
it 'links to the pipelines for the merge request' do
href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target)
expect(page).to have_link "merge request #{todo.target.to_reference}", href
end
end
end end
end end