Could not find generator rspec:install.

后端 未结 11 668
一向
一向 2021-01-01 08:03

I\'m trying to follow this tutorial here: http://railstutorial.org/chapters/static-pages#top

When I run:

$ rails generate rspec:install

相关标签:
11条回答
  • 2021-01-01 08:43

    Add gem 'rspec-rails' in Gemfile and save it. Run bundle command in Terminal. And in config/application.rb, add this line of configuration

    config.generators do |g|
      g.test_framework   :rspec, :fixture => true, :views => false
      g.integration_tool :rspec, :fixture => true, :views => true
    end
    
    0 讨论(0)
  • 2021-01-01 08:44

    Make sure you install rspec-rails and not only rspec. Sigh, I lost some time.

    0 讨论(0)
  • 2021-01-01 08:46

    Restart spring - sometimes it fails to reload after running bundle.

    0 讨论(0)
  • 2021-01-01 08:48

    Add to your Gemfile:

    group :development, :test do
      gem 'rspec-rails',      ">= 2.0.0.beta"
    end
    

    and run bundle install

    That installed nokogiri and afterwards rails generate rspec:install ran as expected.

    0 讨论(0)
  • 2021-01-01 08:48

    By default I had only 'rspec-rails' in my gemfile, and so bundler installed rspec-rails 1.x (some prehistoric version) for some reason. After I modified my gemfile to have gem 'rspec-rails', '~>3.0' and ran bundle update it ran fine.

    0 讨论(0)
  • 2021-01-01 08:59

    I got this same error and found that i had forgotten to save the Gemfile changes I made in Sublime prior to running the Bundle install command. I saved and then reran the bundle install and was able to run the rails generate rspec:install command

    0 讨论(0)
提交回复
热议问题