diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-06-16 15:26:15 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-06-16 15:26:15 +1100 |
commit | 2b1153f71a680b0c5a4fb787897c20068a405fbf (patch) | |
tree | ee6ce0d31e62bf311dfdba364a8f044f8b86b7fa | |
parent | a76066d7fad192d8c339101d9b7dd0048fe6e303 (diff) | |
download | gitlab-ce-2b1153f71a680b0c5a4fb787897c20068a405fbf.tar.gz |
[Rails5] Fix pipeline_schedules_controller_specblackst0ne-rails5-fix-pipeline-schedules-controller-spec
In Rails 5.0 there's a bug [1] in controller tests that doesn't parse
nested parameters correctly.
This commit brings a workaround to make specs work again both in rails4
and rails5.
[1]: https://github.com/rails/rails/issues/23997
-rw-r--r-- | changelogs/unreleased/blackst0ne-rails5-fix-pipeline-schedules-controller-spec.yml | 5 | ||||
-rw-r--r-- | spec/controllers/projects/pipeline_schedules_controller_spec.rb | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/changelogs/unreleased/blackst0ne-rails5-fix-pipeline-schedules-controller-spec.yml b/changelogs/unreleased/blackst0ne-rails5-fix-pipeline-schedules-controller-spec.yml new file mode 100644 index 00000000000..7a2b19ad681 --- /dev/null +++ b/changelogs/unreleased/blackst0ne-rails5-fix-pipeline-schedules-controller-spec.yml @@ -0,0 +1,5 @@ +--- +title: "[Rails5] Fix pipeline_schedules_controller_spec" +merge_request: 19919 +author: "@blackst0ne" +type: fixed diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 3506305f755..4cdaa54e0bc 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -310,9 +310,19 @@ describe Projects::PipelineSchedulesController do end def go - put :update, namespace_id: project.namespace.to_param, - project_id: project, id: pipeline_schedule, - schedule: schedule + if Gitlab.rails5? + put :update, params: { namespace_id: project.namespace.to_param, + project_id: project, + id: pipeline_schedule, + schedule: schedule }, + as: :html + + else + put :update, namespace_id: project.namespace.to_param, + project_id: project, + id: pipeline_schedule, + schedule: schedule + end end end |