A summary of data about the Ruby ecosystem.

https://github.com/rails/rails-controller-testing

Brings back `assigns` and `assert_template` to your Rails tests
https://github.com/rails/rails-controller-testing

Keywords from Contributors

activerecord activejob mvc rubygems feature-flag rack rspec feature feature-toggle sinatra

Last synced: about 22 hours ago
JSON representation

Repository metadata

Brings back `assigns` and `assert_template` to your Rails tests

README.md

Rails::Controller::Testing

This gem brings back assigns to your controller tests as well as assert_template
to both controller and integration tests.

These methods were removed in Rails 5.

Installation

Add this line to your application's Gemfile:

gem 'rails-controller-testing'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rails-controller-testing

RSpec

See https://github.com/rspec/rspec-rails/issues/1393.

rspec-rails automatically integrates with this gem since version 3.5.0.
Adding the gem to your Gemfile is sufficient.

If you use an older version of rspec-rails, you can manually include the
modules in your rails_helper.

RSpec.configure do |config|
  [:controller, :view, :request].each do |type|
    config.include ::Rails::Controller::Testing::TestProcess, :type => type
    config.include ::Rails::Controller::Testing::TemplateAssertions, :type => type
    config.include ::Rails::Controller::Testing::Integration, :type => type
  end
end

Outside Rails

For projects and gems using controller tests outside of a Rails application,
invoke the Rails::Controller::Testing.install method inside your test suite
setup to include the required modules on controller test cases.

# test/test_helper.rb

require 'rails-controller-testing'
Rails::Controller::Testing.install

Usage

assigns

assigns allows you to access the instance variables that have been passed to
your views.

class PostsController < ActionController::Base
  def index
    @posts = Post.all
  end
end

class PostControllerTest < ActionController::TestCase
  def test_index
    get :index
    assert_equal Post.all, assigns(:posts)
  end
end

assert_template

assert_template allows you to assert that certain templates have been rendered.

class PostControllerTest < ActionController::TestCase
  def test_index
    get :index
    assert_template 'posts/index'
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 88
Total Committers: 27
Avg Commits per committer: 3.259
Development Distribution Score (DDS): 0.682

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Guo Xiang Tan t****d@h****m 28
Rafael Mendonça França r****a@g****m 15
eileencodes e****s@g****m 5
Ryo Nakamura r****a@g****m 4
David Rodríguez d****z@r****t 3
John Hawthorn j****n@h****l 3
Lucas Mazza l****a@g****m 3
Olle Jonsson o****n@g****m 3
Prem Sichanugrist s@s****u 3
Sean Griffin s****n@s****m 3
Thibault BENE b****t@g****m 2
Jan David j****d@a****e 1
Sam Phippen s****n@g****m 1
Akira Matsuda r****e@d****p 1
Alex Ghiculescu a****x@t****o 1
Anton Rieder a****r@g****m 1
Dana Scheider d****r@g****m 1
Emil Sågfors e****s@i****i 1
František Dvořák v****i@c****z 1
Harry Grillo h****y@r****m 1
Jeroen Visser j****1 1
Jon Rowe m****l@j****k 1
Kasper Timm Hansen k****h@g****m 1
Marcus Heng m****z@g****m 1
Mike Moore m****e@b****m 1
Mingan ja@m****e 1
Orien Madgwick 4****n 1

Committer domains:


Issue and Pull Request metadata

Last synced: 11 days ago

Total issues: 38
Total pull requests: 41
Average time to close issues: 4 months
Average time to close pull requests: 4 months
Total issue authors: 34
Total pull request authors: 32
Average comments per issue: 4.63
Average comments per pull request: 2.24
Merged pull request: 29
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 1
Past year pull request authors: 0
Past year average comments per issue: 0.0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/rails/rails-controller-testing

Top Issue Authors

  • jasnow (4)
  • jasonfb (2)
  • mjhenkes (1)
  • MunimIftikhar (1)
  • fredngo (1)
  • Edouard-chin (1)
  • fwininger (1)
  • djpate (1)
  • connorshea (1)
  • mahemoff (1)
  • mhartl (1)
  • jstoebel (1)
  • corymcdonald (1)
  • navidemad (1)
  • spurnaye (1)

Top Pull Request Authors

  • tgxworld (4)
  • olleolleolle (4)
  • orien (3)
  • r7kamura (2)
  • Shuiei (2)
  • danascheider (1)
  • deivid-rodriguez (1)
  • lucasmazza (1)
  • jeroenvisser101 (1)
  • ionut998 (1)
  • mingan (1)
  • voxik (1)
  • jdno (1)
  • blowmage (1)
  • yuri-zubov (1)

Top Issue Labels

  • bug (4)
  • more-information-needed (3)

Top Pull Request Labels


Package metadata

gem.coop: rails-controller-testing

Extracting `assigns` and `assert_template` from ActionDispatch.

debian-13: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Documentation: https://packages.debian.org/trixie/ruby-rails-controller-testing
  • Licenses: mit
  • Latest release: 1.0.5-2 (published 19 days ago)
  • Last Synced: 2026-02-13T13:18:55.467Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.491%
    • Stargazers count: 0.958%
    • Forks count: 1.008%
rubygems.org: rails-controller-testing

Extracting `assigns` and `assert_template` from ActionDispatch.

ubuntu-20.04: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.4-2 (published 18 days ago)
  • Last Synced: 2026-02-13T07:21:14.787Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-11: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Documentation: https://packages.debian.org/bullseye/ruby-rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-1 (published 21 days ago)
  • Last Synced: 2026-02-13T08:24:10.349Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.04: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-2 (published 20 days ago)
  • Last Synced: 2026-02-11T06:47:48.723Z (20 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.10: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-2 (published 22 days ago)
  • Last Synced: 2026-02-09T17:08:43.439Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-12: ruby-rails-controller-testing

ubuntu-23.10: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-2 (published 18 days ago)
  • Last Synced: 2026-02-13T18:31:02.748Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-22.04: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-2 (published 18 days ago)
  • Last Synced: 2026-02-13T13:24:03.986Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.04: ruby-rails-controller-testing

  • Homepage: https://github.com/rails/rails-controller-testing
  • Licenses:
  • Latest release: 1.0.5-2 (published 25 days ago)
  • Last Synced: 2026-02-06T15:51:18.694Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:

Dependencies

rails-controller-testing.gemspec rubygems
  • activerecord-jdbc-adapter >= 0 development
  • jdbc-sqlite3 >= 0 development
  • railties >= 5.0.1.rc1 development
  • sqlite3 >= 0 development
  • actionpack >= 5.0.1.rc1
  • actionview >= 5.0.1.rc1
  • activesupport >= 5.0.1.rc1
Gemfile rubygems

Score: 30.283779284570997