Rails 5 - Controller generator doesn't generate test suite

10 views
Skip to first unread message

Srinivasa Raghavan Kandala

unread,
Oct 16, 2016, 12:04:56 PM10/16/16
to bangal...@googlegroups.com
Hello Guys,

  I was trying out Rails 5 with a sample app and was using the controller generator to generate a controller. 

  Eg: rails generate controller StaticPages home help 

      create  app/controllers/static_pages_controller.rb
       route  get 'static_pages/help'
       route  get 'static_pages/home'
      invoke  erb
      create    app/views/static_pages
      create    app/views/static_pages/home.html.erb
      create    app/views/static_pages/help.html.erb
      invoke  helper
      create    app/helpers/static_pages_helper.rb
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/static_pages.coffee
      invoke    scss
      create      app/assets/stylesheets/static_pages.scss

 No files related to test suite are generated.

 Did any of you face this issue before or am I missing something ? 

Thanks,
Raghavan.

Nithin Bekal

unread,
Oct 17, 2016, 1:38:41 AM10/17/16
to bangal...@googlegroups.com
It's probably disabled in config/application.rb. Do you have a config.generators block with config.test_framework nil?

--
You received this message because you are subscribed to the Google Groups "BANGALORE RUG-Ruby Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bangalorerug+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Srinivasa Raghavan Kandala

unread,
Oct 17, 2016, 1:54:28 AM10/17/16
to bangal...@googlegroups.com
Thanks for the hint Nithin. 

I don't have any such block in the application.rb file, but the following line 
require "rails/test_unit/railtie" in that file was commented out. 

Uncommenting that line out did generate the test suite also. I looked in all the config files except this one.

I wonder why that line is commented out ? This is a new blank app generated using rails new. Is it because people use Rspec more than test_unit / minitest ? 

Thanks & Regards,
Raghavan.


Srinivasa Raghavan Kandala

unread,
Oct 19, 2016, 12:01:23 PM10/19/16
to bangal...@googlegroups.com
The code generator problem got fixed, however I am still not able to run the test. 

rails test => throws uninitailized constant ActionDispatch

rake test => throws undefined local variable or method static_pages_home_url 

But, I have the necessary routes defined for this named url to work. 


Reply all
Reply to author
Forward
0 new messages