Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,761
    • Issues 44,761
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,332
    • Merge requests 1,332
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #16260
".gitlab/issue_templates/Test plan.md" did not exist on "master"
Closed
Open
Issue created Oct 25, 2016 by Adam Niedzielski@adamniedzielskiContributor

Deprecate usage of assigns and render_template in our controller tests

Description

Rails 5 removes assigns and assert_template from its core and we have to include rails-controller-testing gem to migrate to Rails 5 (gitlab-foss!5555 (closed)). The motivations provided in http://blog.bigbinary.com/2016/04/19/changes-to-test-controllers-in-rails-5.html are following: (copy-paste)

Reasons for removing assigns and assert_template

The idea behind the removal of these methods is that instance variables and which template is rendered in a controller action are internals of a controller, and controller tests should not care about them.

According to Rails team, controller tests should be more concerned about what is the result of that controller action like what cookies are set, or what HTTP code is set rather than testing of the internals of the controller. So, these methods are removed from the core.

Proposal

Deprecate assigns and render_template in our controller specs. Include a section in https://docs.gitlab.com/ce/development/testing.html that asks people not to use them in new tests.

Status as of %13.8

$ git grep assigns -- {,ee/}spec/controllers | wc -l
442
$ git grep render_template -- {,ee/}spec/controllers | wc -l
251

Links / references

http://blog.bigbinary.com/2016/04/19/changes-to-test-controllers-in-rails-5.html

/cc @stanhu @dzaporozhets

Edited Jan 06, 2021 by Takuya Noguchi
Assignee
Assign to
Time tracking