Could not find generator rspec_model issue

后端 未结 2 872
感动是毒
感动是毒 2021-01-22 22:33

I am trying to create an rspec for my model User but every time I run:

rails g rspec_model User

I get Could not find generator rspec_model.

相关标签:
2条回答
  • 2021-01-22 22:39

    Please use (once):

    rails generate rspec:install
    

    It will create the various files and the spec directory. You will then need to, for example, create the models directory and start creating specs in that directory.

    Once you configure your application for rspec, script/rails generate ModelName will also create the rspec skeleton files I believe.

    0 讨论(0)
  • 2021-01-22 22:52

    https://github.com/rspec/rspec-rails/tree/4c8cdaef2c6f3dda29d45b7900f0b00335eeec84/lib/generators/rspec/model

    rails g rspec:model Movie
    rails g rspec:model Movie  --fixture  #tested in rails 3.1 for rspec 2.8.0
    
    0 讨论(0)
提交回复
热议问题