Skip to content

Resolve "[Rails5] `ActionView::MissingTemplate` in spec/features/projects/wiki/user_views_wiki_page_spec.rb"

What does this MR do?

In rails 4 the route default parameter falls to text/html if its value is nil.
In rails 5 it doesn't act like that anymore.

See https://github.com/rails/rails/issues/28901 and https://github.com/rails/rails/pull/20831

In this MR an explicit format value was added to act like rails 4.

Fixes rails5 errors:

  1) User views a wiki page when Gitaly is enabled behaves like wiki page user view when a page does not have history shows the creation page if file does not exist
     Failure/Error: render 'edit'

     ActionView::MissingTemplate:
       Missing template projects/wikis/edit, projects/application/edit, application/edit with {:locale=>[:en], :formats=>[:jpeg], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :haml]}. Searched in:
         * "/builds/gitlab-org/gitlab-ce/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/peek-sidekiq-1.0.3/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/peek-redis-1.2.0/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/peek-rblineprof-0.2.0/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/peek-gc-0.0.2/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/peek-1.0.1/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/kaminari-core-1.0.1/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/graphiql-rails-1.4.10/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/doorkeeper-4.3.2/app/views"
         * "/builds/gitlab-org/gitlab-ce/vendor/ruby/2.4.0/gems/devise-4.4.3/app/views"
     Shared Example Group: "wiki page user view" called from ./spec/features/projects/wiki/user_views_wiki_page_spec.rb:151
     # ./app/controllers/projects/wikis_controller.rb:34:in `show'
     # ./lib/gitlab/i18n.rb:50:in `with_locale'
     # ./lib/gitlab/i18n.rb:56:in `with_user_locale'
     # ./app/controllers/application_controller.rb:360:in `set_locale'
     # ./lib/gitlab/middleware/multipart.rb:95:in `call'
     # ./lib/gitlab/request_profiler/middleware.rb:14:in `call'
     # ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
     # ./lib/gitlab/query_limiting/transaction.rb:37:in `run'
     # ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
     # ./lib/gitlab/middleware/go.rb:17:in `call'
     # ./lib/gitlab/etag_caching/middleware.rb:11:in `call'
     # ./lib/gitlab/middleware/read_only/controller.rb:28:in `call'
     # ./lib/gitlab/middleware/read_only.rb:16:in `call'
     # ./lib/gitlab/request_context.rb:18:in `call'
     # ./config/initializers/fix_local_cache_middleware.rb:9:in `call'
     # ./lib/gitlab/middleware/static.rb:9:in `call'
     # ./lib/gitlab/testing/request_inspector_middleware.rb:31:in `call'
     # ./lib/gitlab/testing/request_blocker_middleware.rb:45:in `call'
     # ./lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
     # ./spec/features/projects/wiki/user_views_wiki_page_spec.rb:108:in `block (4 levels) in <top (required)>'

Are there points in the code the reviewer needs to double check?

No.

Why was this MR needed?

Migration to Rails 5.0

Screenshots (if relevant)

No.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #47738 (closed)

Edited by Rémy Coutable

Merge request reports