diff options
author | Robert Speicher <robert@gitlab.com> | 2016-12-22 15:56:08 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-12-22 15:56:08 +0000 |
commit | 8dfa41016b2830fa9cfcf87e55e42e6a2a8c9a07 (patch) | |
tree | af7b9a715e92d5493d47565c999582663f3469c7 | |
parent | 19b0af4e876050dc31028f711057618846421d70 (diff) | |
parent | 22bbb24f28718849934693b8163155ccae4c4b5e (diff) | |
download | gitlab-ce-8dfa41016b2830fa9cfcf87e55e42e6a2a8c9a07.tar.gz |
Merge branch '25979-fix-todos-on-failed-build' into 'master'
Fix viewing "build failed" TODOs
Closes #25979
See merge request !8262
-rw-r--r-- | app/helpers/todos_helper.rb | 2 | ||||
-rw-r--r-- | spec/factories/todos.rb | 1 | ||||
-rw-r--r-- | spec/features/todos/todos_spec.rb | 19 |
3 files changed, 21 insertions, 1 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 09c69786791..74de25acf9d 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -35,7 +35,7 @@ module TodosHelper else 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) end diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index 866e663f026..082b02116c0 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -21,6 +21,7 @@ FactoryGirl.define do trait :build_failed do action { Todo::BUILD_FAILED } + target factory: :merge_request end trait :approval_required do diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index 88eabea7e3a..4bda0927692 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -155,5 +155,24 @@ describe 'Dashboard Todos', feature: true do expect(page).to have_selector('.todos-all-done', count: 1) 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 |