Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails-Controller-testing breaks View specs. #12

Closed
b-sridhar opened this issue Jan 28, 2016 · 0 comments
Closed

Rails-Controller-testing breaks View specs. #12

b-sridhar opened this issue Jan 28, 2016 · 0 comments
Labels

Comments

@b-sridhar
Copy link

After adding the rails-controller-testing gem, the View specs fail as the "render" method is no longer recognized.

Environment: Rails: Rails 5.0.0.beta1.1, Ruby: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
Steps to reproduce:

  1. rails new example
  2. cd example
  3. echo 'gem "rspec-rails", :group => [:development, :test]' >> Gemfile
  4. Uncomment "gem 'therubyracer', platforms: :ruby" in the Gemfile.
  5. Bundle update.
  6. rails generate rspec:install
  7. rails generate scaffold Widget name:string
  8. rake db:migrate && rake db:test:prepare
  9. bundle exec rspec spec [Only the controller test fails.]
  10. Add "gem 'rails-controller-testing'" to the Gemfile.
  11. Add the following to rails_helper.rb:
    config.include Rails::Controller::Testing::TestProcess
    config.include Rails::Controller::Testing::TemplateAssertions
    config.include Rails::Controller::Testing::Integration
  12. bundle update.
  13. bundle exec rspec spec/views
  14. View specs fails for named paths while invoking render with the following error:
widgets/show renders attributes in <p>
     Failure/Error: render
     ActionView::Template::Error:
       undefined method `edit_widget_path' for #<#<Class:0x007f3eef218588>:0x007f3ef2106958>
     # ./app/views/widgets/show.html.erb:8:in `_app_views_widgets_show_html_erb__3037541516540118700_69954162933900'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/template.rb:159:in `block in render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications.rb:164:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/template.rb:353:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/template.rb:157:in `render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/activesupport-5.0.0.beta1.1/lib/active_support/notifications.rb:164:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/renderer/renderer.rb:23:in `render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/helpers/rendering_helper.rb:32:in `render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/test_case.rb:199:in `render'
     # /home/vagrant/.gem/ruby/2.3.0/gems/actionview-5.0.0.beta1.1/lib/action_view/test_case.rb:120:in `render'
     # ./spec/views/widgets/show.html.erb_spec.rb:11:in `block (2 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants