ruby - Rails Tutorial (M. Hartl) Chapter 3, Missing `static_pages_controller_test.rb` folder after `rails generate`? -


i'm working on michael hartl's ror tutorial chapter 3.2.1 , i'm generating static pages controller using command:

$ rails generate controller staticpages home 

but after doing cannot see see test/controllers/static_pages_controller_test.rb file being generated in book (see tenth line):

$ rails generate controller staticpages home       create  app/controllers/static_pages_controller.rb        route  'static_pages/help'        route  '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  test_unit       create    test/controllers/static_pages_controller_test.rb       invoke  helper       create    app/helpers/static_pages_helper.rb       invoke    test_unit       create      test/helpers/static_pages_helper_test.rb       invoke  assets       invoke    coffee       create      app/assets/javascripts/static_pages.js.coffee       invoke    scss       create      app/assets/stylesheets/static_pages.css.scss 

here's looks when run it:

screenshot

my folder empty , cannot run tests.

i think may have mixed editions of michael hartl's ruby on rails tutorial.

the 3rd edition uses minitest instead of rspec. app seems setup use rspec different test framework used in 2nd edition.

if want know why generating rspec specs instead of tests because ran:

rails generate rspec:install 

which changes generators generate specs instead.

the simplest way remedy delete current sample_app directory , start on beginning of chapter 3 , make sure use current edition:

https://www.railstutorial.org/book/static_pages

there other ways might easier avoid other mishaps down line if fresh start.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -